Pipelines with decisions and error handling
Watch the pipeline decide — and recover from failure
- 1 Go to Downloads (curriculum.32dots.de/share) and download 'Session 6 — Decisions and error handling'.
- 2 In n8n: ⋯ → Import from file. Open the chat panel.
- 3 Type: 'Summarise paper 38167000' (a valid PMID).
- 4 Watch the execution log — which path fired? Which nodes are highlighted green?
- 5 Type: 'What is the latest in cancer immunotherapy?' (no PMID — false path fires).
- 6 Type: 'Summarise 99999999' (non-existent PMID — HTTP error path fires).
- 7 In the execution log, click the 'Fetch Paper' node. Find the error output connector highlighted in red.
You triggered all three execution paths and can identify which node and branch fired in each case.
IF nodes, error outputs, and Continue on error
A production workflow never receives only valid inputs. Design for failure first, happy path second. The IF node handles expected variation (has PMID or not). The error output handles unexpected failures (PubMed returns 404). These are different — don't conflate them.
- ?What is the difference between an IF node and 'Continue on error'? Give one scenario where you'd use each.
- ?What happens if you disable 'Continue on error' on Fetch Paper and send PMID 99999999?
- ?How would you log every error to a Postgres database automatically?
Add error counting and logging
Add a logging mechanism: after each run, write to an n8n variable or a Set node that counts successes and failures in the session.
- 1 After the AI Summarize node, add a Set node: result = 'success', pmid = $json.pmid.
- 2 After the HTTP Error node, update it to also set: result = 'error'.
- 3 After the No PMID Guide node, update it: result = 'no_pmid'.
- 4 Add a final Set node that merges all paths (use the Merge node or accept that only one path fires per run).
- 5 Test with three different inputs — valid PMID, bad PMID, no PMID. Confirm the result field is set correctly in all three cases.
- 6 Add a Sticky Note documenting: what each path produces and when.
Export the workflow and share a screenshot of the execution log showing all three paths tested in sequence.
✎Your workflow now handles three cases explicitly. But what about rate limits (HTTP 429) vs. not-found (HTTP 404)? They both trigger the error path. How would you distinguish them and handle each differently?