Automation · n8n
Branching
Cheat sheet · https://pcornel.dk/topic.php?topic=5582
Answer
Branching in n8n uses the IF and Switch nodes to send items down different paths based on conditions, merging them later with the Merge node if needed.
Remember
- IF and Switch nodes branch workflows.
- Merge rejoins branches.
- Test each path.
First checks
- IF/Switch nodes — branching
- Default/fallback branch — unexpected values
- Merge node behaviour — joining
Verify in this order
items → IF/Switch → branches → merge
Where it usually breaks
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
n8n → Branching · operational reference
| Layer | n8n → Branching operational reference |
|---|---|
| Runtime/ownership | n8n workflow branching · the n8n execution engine evaluating an If/Switch decision for one workflow execution |
| Persistent intent | workflow JSON containing node parameters, expressions and outgoing connections |
| Verification | Execute the workflow with pinned fixture data; inspect the Branch/If node input and each output branch in the execution view; verify only the intended downstream target changed. |
| Expected interpretation | Each fixture item follows the branch implied by the evaluated n8n expression, nonmatching items do not reach protected side effects, and downstream target state matches the selected path. |
| Recovery boundary | preserve execution data and node input/output, correct the first wrong expression or route, then replay a bounded fixture and verify the downstream target |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5582