Can you trap a cannon in xiangqi?
These answers restate the rules implemented by our open-source engine, which follows the WXF laws and is regression-tested against the official 110-diagram repetition casebook. Where an answer refers to a specific position, that position lives on the linked reference page, where the build verifies it against the engine before publishing.
Direct answer
Yes, though less easily than a horse. A cannon needs a clear line to move, and it cannot go around anything — so a cannon that has committed deep into your half can be cut off by occupying the lines behind it, and then attacked by a piece it cannot answer.
How it happens
Usually to a bottom-rank cannon that arrived without support. Block the rank on one side, block the file on the other, and it has nowhere to go; then attack it with a chariot or horse. Because the cannon is worth 4.5, that is a winning material operation.
Avoiding it
Do not send a cannon to the back rank without a plan for a second attacker, and keep an escape line in mind before committing. A cannon behind enemy lines with no route home is a liability rather than an attacker.
Related questions
Is a cannon easier to trap than a horse?
No, harder — it only needs one clear line, and clear lines are usually available.
Can a cannon capture its way out?
Only if there is exactly one piece between it and an enemy piece on the escape line. Often there is not.