n8n-error-handling
Wire n8n error handling so failures are loud, structured, and recoverable
Install / Use
npx skills add czlonkowski/n8n-skills --skill n8n-error-handlingInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
AutomationSupported Platforms
Our assessment of n8n-error-handling
n8n-error-handling scores 84/100 on our quality scale, 994th of 1,554 Automation skills we index.
Its SKILL.md is 20 KB long, well organised into 15 sections with 6 code examples: a thorough specification that gives an agent plenty to work with.
With 6,309 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 10 days ago, so n8n-error-handling is actively maintained.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
n8n-error-handling compared with similar skills
All 4 of these similar skills score higher than n8n-error-handling; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| n8n-error-handling (this skill)by czlonkowski | 84 | 6.3k | 10d ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 85.6k | 11d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 73.9k | today | CLAUDE.md |
| rufloby ruvnet | 100 | 73.3k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 83.9k | today | MCP Server |
Frequently asked questions
- How do I install n8n-error-handling?
- Run
npx skills add czlonkowski/n8n-skills --skill n8n-error-handling. The install tabs above show the steps for each supported agent. - Which AI agents does n8n-error-handling work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is n8n-error-handling safe to use?
- It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is n8n-error-handling still maintained?
- The repository was last updated 10 days ago, so n8n-error-handling is actively maintained.
Skill content
View source on GitHubname: n8n-error-handling description: Wire n8n error handling so failures are loud, structured, and recoverable. Use when building any webhook/API workflow, a scheduled or unattended workflow, or any path where a silent failure would drop user-visible work — and whenever the user mentions error handling, onError, continueErrorOutput, error branches/outputs, retries, retryOnFail, Respond to Webhook status codes, 4xx/5xx, Error Trigger, or "my workflow fails silently". Covers per-node error outputs and wiring, retry/self-healing, error-trigger workflows, and 4xx/5xx response shapes.
n8n Error Handling
By default, when an n8n node throws, the whole workflow halts. For an interactive run you're watching, that's fine — you see the red node and fix it. For anything unattended (a webhook API, a cron job, a queue worker, an agent tool), it's the wrong default: the caller gets a timeout or an empty 500, the operator gets no alert, and the symptom is "the integration just stopped working" with no log and no clue.
This skill is about making failures loud, structured, and recoverable — and, best case, self-healing so transient blips never reach a human at all.
The two ideas that prevent most silent failures:
- Per-node error outputs — a node's failure routes down a second output you control, instead of killing the run.
- A workflow-level error workflow — a catch-all that fires for anything that escapes per-node handling (timeouts, crashes between nodes, unwired failures).
When you actually need this
| Workflow shape | Error handling posture |
|---|---|
| Webhook / API (anything with Respond to Webhook) | Required. Every fallible node's error output wired; status code matches cause. |
| Scheduled / cron / queue worker / agent tool (unattended) | Required. A workflow-level error workflow, plus retryOnFail on network nodes. |
| Internal one-off you run and watch yourself | Optional. Default onError: "stopWorkflow" is fine — you'll see the red node and re-run. |
The dividing line: if anyone other than you sees the output — a downstream system, an end user, an on-call engineer — the failure has to be handled, not swallowed. If you're the only watcher and the cost of failure is "I notice and re-run", looser is fine.
The #1 silent trap: per-node error output is a TWO-step setup
This is the single most common way an n8n workflow "handles" errors while actually swallowing them. Routing a node's failure to a handler takes two changes, and doing only one looks complete but misbehaves:
- Set
onError: "continueErrorOutput"on the node. This is what creates the second output. Without it,main[1]doesn't exist no matter what you wire. - Wire that error output (
connections.<node>.main[1], i.e.sourceIndex: 1) to a real handler. Without a target, the error data is emitted into the void.
Get one without the other and you hit a failure mode:
| What you did | What happens at runtime |
|---|---|
| onError set, error output not wired | Error data is silently discarded. Downstream doesn't fire. The dashboard shows the run as succeeded. Worst case — no error logged anywhere. |
| Error output wired, onError not set | The slot never fires; the handler is unreachable. On failure the workflow just halts (default stopWorkflow). |
| Both done | Failure routes down main[1] to your handler. ✅ |
Doing both with n8n_update_partial_workflow
// 1) Turn on the error output (creates main[1])
{ type: "updateNode", nodeName: "HTTP Request",
changes: { onError: "continueErrorOutput" } }
// 2) Wire the error output to a handler. sourceIndex: 1 = the error output.
{ type: "addConnection",
source: "HTTP Request",
target: "Handle Error",
sourceIndex: 1 }
sourceIndex: 0 is the success path, sourceIndex: 1 is the error path. (For IF nodes the aliases branch: "true"/"false" map to index 0/1; for a generic fallible node, use the explicit sourceIndex: 1.)
Then verify. This trap doesn't surface in validate_workflow — a half-wired error output validates clean. Pull the workflow with n8n_get_workflow and confirm both halves:
- The node's
onErroris"continueErrorOutput". connections["HTTP Request"].main[1]contains your handler.
Valid onError values:
| Value | Effect |
|---|---|
| "stopWorkflow" (default) | Error halts the whole workflow. |
| "continueRegularOutput" | Error item flows out the normal output. Rare, usually wrong — downstream gets error-shaped data and keeps going. |
| "continueErrorOutput" | Error item flows out the separate error output (main[1]). The one you wire. |
Full failure-mode catalog, fan-in/fan-out shapes, and verification: NODE_ERROR_OUTPUTS.md.
Failures the error output never sees
A correctly wired error output still misses whole classes of failure. Verified on n8n 2.38.5:
| Failure | With continueErrorOutput | With continueRegularOutput |
|---|---|---|
| JS error inside {{ }} (TypeError on a missing path, JSON.parse on bad input, a thrown Error, a JMESPath syntax error) | nothing fires; the field is null and items take the success path | same |
| Python Code node rejected before running (blocked import, dunder access: Security violations detected) or bad return shape (list in each-item mode) | node marked failed, but the unchanged input items leave through the success output; main[1] stays empty and the execution shows success | unchanged input items pass through |
| Exception while code runs (raise/throw, KeyError, NameError) | routed to main[1] as { error } ✅ | { error } item on the main output |
So an error branch alone can't guard these:
- Guard the data, not just the node. After a transform whose output matters, check that the
field you produced exists (IF/Filter on
{{ $json.total !== undefined && $json.total !== null }}) and send the miss down the error path yourself. - Test-run and read node statuses and output values. The Python cases show a red node inside a
green execution. The expression cases show nothing but
nulls. - Root causes and fixes: n8n-expression-syntax (Debugging) and n8n-code-python (Errors and
onError).
Self-healing first: retryOnFail before you wire error paths
Before you build error branches, absorb the transient failures so they never reach those branches. On any node that calls a network service — HTTP Request, comms (Gmail/Slack/Discord), databases, AI nodes, third-party integrations — set node-level retry:
{ type: "updateNode", nodeName: "HTTP Request",
changes: {
retryOnFail: true,
maxTries: 3,
waitBetweenTries: 5000 // ms
} }
Why this comes first: a 429 or a brief upstream hiccup will retry and usually succeed on its own. The error output then fires only on real, persistent failures — so your 5xx responses and on-call alerts reflect actual problems instead of noise.
Engine limits to know: retry fires on any error (there's no per-status-code filter), maxTries caps at 5, and waitBetweenTries caps at 5000ms — so 5000 is both the max and a sensible default. See n8n-node-configuration (NODE_FAMILY_GOTCHAS.md) for node-specific notes.
API workflows: the canonical shape
A webhook-triggered workflow that responds to its caller has one rule that overrides everything else: no hanging branches. Every path — success and every error — must end at a Respond to Webhook, or the caller sits there until it times out.
Webhook (responseMode: "responseNode")
├── validate input → process → Respond (200, body)
└── (any fallible node's error output → sourceIndex 1)
→ Respond (4xx/5xx, structured error body)
→ optional: log full error privately / notify
Three things make this work:
- Fan-in to one error responder. Many fallible nodes can route their
main[1]to a singleRespondnode. Keeps the graph readable. - Validation failures (4xx) are checked upstream, not via error outputs. A missing field isn't a node crashing — it's an expected outcome with a known response. Branch on it with IF/Switch (or the schema validator below) and return 400/401/403/404 directly. Error outputs are for unexpected failures (5xx).
responseCodedefaults to 200 — even on error branches. This is its own silent trap (see RESPONSE_SHAPES.md and n8n-node-configuration NODE_FAMILY_GOTCHAS.md): an error branch that returns 200 with an error body looks like success to the caller's HTTP client, so their error handling never fires. SetresponseCodeexplicitly on every Respond node.
Input validation: the Set-node schema validator
For any endpoint doing structured input validation, run the check as an IIFE inside a single Set node rather than a chain of IF/Switch nodes per field. One node validates the whole payload, returns { valid, validationError, details, requiredSchema }, and an IF branches on valid → your logic (200) or a 400 Respond that echoes the schema back so the caller can self-correct. It's also dramatically faster than a recursive validator in a Code node + sub-workflow. The full pattern, the constraint cookbook, and the expression-escaping gotchas live in API_WORKFLOWS.md.
Response shapes: map cause → status code
A 5xx with text/plain "Internal Server Error" is technically an error response and practically useless. And not every failure is a 5xx. Match the status code to why the request failed, because the caller branches on it: their monitoring alerts on 5xx (your fault) but not 4xx (their fault), and 5xx suggests "retry" while 4xx suggests "don't".
The common mistake: wiring everything — including bad input — to one Respond that returns 500 internal_error. Now the caller can't tell their bug from your outage, and your error rates can't separate real incidents from client noise.
| Cause | Status | error code | Where it's handled |
|---|---|---|---|
| Required field missing / wrong type | 400 | validation_error | Upstream check (schema validator / IF), not error output |
| Auth missing or invalid | 401 | unauthorized | Upstream check |
| Authenticated but not allowed | 403 | forbidden | Upstream check |
| Resource ID valid in request, absent in your data | 404 | not_found | Branch on the lookup result, not its error |
| Conflicts with current state (duplicate, race) | 409 | conflict | Detect with logic |
| Caller exceeded rate limit | 429 | rate_limit_exceeded | Set Retry-After header |
| Node threw, cause unknown | 500 | internal_error | Error output path |
| Third-party API returned an error | 502 | upstream_error | Error output of the HTTP node |
| Can't process right now (downstream down) | 503 | service_unavailable | Detect specific error, hint retry |
| Third-party API timed out | 504 | upstream_timeout | Error output filtered by message |
So there are two distinct flows: 4xx is decided before the work (IF/Switch + dedicated Respond), 5xx comes out of error outputs ("we tried, it broke").
One Respond, expression-driven code. When error paths differ only by number and message (same body shape, same headers), don't fan out to N Respond nodes through a Switch. The Respond node accepts expressions in both Response Code and body — compute the code inline:
// Response Code field on a single Respond to Webhook:
{{ (() => {
const msg = $json.error?.message || $json.message || '';
if (msg.includes('INVALID_ID')) return 400;
if (/429|too many/i.test(msg)) return 429;
if (/timeout/i.test(msg)) return 504;
if (/upstream|llm|api/i.test(msg)) return 502;
return 500;
})() }}
Reserve Switch + multiple Responds for paths that diverge structurally (different headers, different body shapes, redirects). Same shape with a diffe
Truncated for display — read the full file on GitHub.
Related Skills
Agent-Reach
85.6kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
73.9kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
ruflo
73.3k🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
Scrapling
83.9k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
