Agent Native

n8n-error-handling-official

This skill guides agents to build robust error handling in n8n workflows, especially for webhook APIs and scheduled jobs.

by n8nOfficial publisherNot reviewed

Identity proven by GitHub's verified organisation badge (n8n-io)

Agents
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode
License
Apache-2.0 (permissive)
Pin
180b841pinned Oct 9, 2026
Context cost
about 2,900 tokenswhen the skill loads
GitHub stars
524on n8n-io/skills
Scripts
2 scripts

What it does

“Use when building any webhook-triggered workflow, scheduled/production-bound workflow, wiring a per-node error output, or any workflow where silent failure would drop user-visible work. Triggers on "webhook", "respond to webhook", "API", "production", "error", "failure", "5xx", "try/catch", "error workflow", "onError", "continueErrorOutput", "error branch", "node error output", "output(1)", "main[1]", "scheduled", or any workflow that runs unattended.”
The author's description, from SKILL.md

Generated summary from the skill's own text

This skill guides agents to build robust error handling in n8n workflows, especially for webhook APIs and scheduled jobs. It provides patterns for wiring per-node error outputs to Respond nodes with appropriate status codes, configuring retry logic on network calls, and setting up workflow-level error handlers to prevent silent failures.

When to use it

  • Building webhook-triggered or API-shaped workflows with Respond to Webhook nodes
  • Creating scheduled or production-bound workflows that run unattended
  • Wiring error outputs on fallible nodes like HTTP Request or database calls
  • Designing input validation endpoints with structured error responses

When not to

  • Internal one-off workflows where you are the sole user and can manually rerun on failure
  • Workflows with no downstream impact or external callers

Install

These commands install from the publisher's repository and need no account.

skills CLI

npx skills add n8n-io/skills --skill n8n-error-handling-official

Installs from the repository's default branch, which may have changed since the commit we checked.

GitHub CLI 2.90 or later

gh skill install n8n-io/skills n8n-error-handling-official@180b8415e3b73f78828cfa01e908e67f89f2a139

Installs the commit we checked (180b841).

Copy by hand

Download the folder at 180b841 and put it in .claude/skills/n8n-error-handling-official for Claude Code and in .agents/skills/n8n-error-handling-official for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.

Skill folder on GitHub at 180b841

Copy for your agent

A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.

Prompt

Install the agent skill "n8n-error-handling-official" by n8n.

Source, pinned to commit 180b8415e3b73f78828cfa01e908e67f89f2a139:
https://github.com/n8n-io/skills/tree/180b8415e3b73f78828cfa01e908e67f89f2a139/skills/n8n-error-handling-official

1. Download that folder at exactly this commit. Do not use the default branch.
2. Copy every file unchanged, keeping the folder structure, into .claude/skills/n8n-error-handling-official/ for Claude Code and .agents/skills/n8n-error-handling-official/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist.
3. Do not edit the files, and do not run any script in the folder unless I ask you to.
4. When you are done, list the files you copied and where you put them.

Listing and checks: https://www.agentnative.dev/skills/n8n/n8n-error-handling-official

SKILL.md at the pin

---
name: n8n-error-handling-official
description: Use when building any webhook-triggered workflow, scheduled/production-bound workflow, wiring a per-node error output, or any workflow where silent failure would drop user-visible work. Triggers on "webhook", "respond to webhook", "API", "production", "error", "failure", "5xx", "try/catch", "error workflow", "onError", "continueErrorOutput", "error branch", "node error output", "output(1)", "main[1]", "scheduled", or any workflow that runs unattended.
---

# n8n Error Handling

Default n8n node behavior: error → workflow halts → caller gets nothing useful. For unattended workflows (webhook APIs, scheduled jobs, queue workers), that default is wrong. The symptom is "the integration just stopped working" with no log, no message, no clue.

This skill is about handling errors so failures are loud, structured, and recoverable. Or best case scenario, handled in a way where it self heals.

## Non-negotiables

For any **API-shaped workflow** (webhook trigger paired with `Respond to Webhook`):

1. **Every fallible node's error output is wired, and both paths end at a `Respond to Webhook`.** No hanging error branches, or the caller would see a timeout. "Fallible" = HTTP, DB, third-party API, file operation, anything that throws.
2. **Status code maps to cause.** Caller's fault → 4xx, your fault → 5xx. A 200 default on an error path produces silent failure: caller thinks success, processes empty data.

For any **unattended workflow** (scheduled, cron, queue-driven, agent tool):
3. **Set a workflow-level error workflow.** Catches what escapes per-node handling: timeouts, crashes between nodes, errors in unwired nodes. Set it via `update_workflow` `setWorkflowSettings.errorWorkflow` (n8n 2.29.0+); the target must be a published workflow containing an active Error Trigger, or the update is rejected. See `references/ERROR_WORKFLOWS.md`.

## Strong defaults

- **Error response bodies are structured.** Not just "Internal Server Error". Use `{ "error": "<short identifier>", "message": "<human-readable>" }`. See `references/RESPONSE_SHAPES.md`.
- **Network-calling nodes have `retryOnFail` configured.** Transient 429s and upstream blips get absorbed before reaching the error path. See "Self-healing on transient failures" below.

## When error handling can be looser

Internal one-off workflows where you're the only user, you watch each run, and the cost of failure is "I notice and re-run". Default `onError: 'stopWorkflow'` is fine. The line: if anyone other than you sees the output (downstream system, end user, on-call), the non-negotiables apply.

## API workflow shape

The canonical webhook-API workflow:

```
Webhook trigger
  ├── (success path)  → Process → Respond to Webhook (200, body)
  └── (any node's error output)
                       → Respond to Webhook (5xx, structured error body)
                       → Optional: log to error tracker / logger / notify channel
```

For a complete walkthrough including how to wire multiple fallible nodes to a single error responder, see `references/API_WORKFLOWS.md`.

## Schema validator (Set IIFE)

For any webhook API doing input validation, lift the Set-based schema validator pattern into the endpoint instead of writing IF/Switch chains per field. The two example files are the source of truth:

- `references/examples/validation-subworkflow.ts`: the bare pattern (Webhook → Set with the validation IIFE → Respond, expression-driven status code). Useful as a minimal demo.
- `references/examples/validation-subworkflow-usage.ts`: the endpoint pattern (Webhook → Set → If valid → your business logic → 200 success / 400 with the standard `{error: "validation_error", message, details, request_schema}` body). Lift this into your endpoint and replace the NoOp placeholder with real logic.

**The procedure for an agent using this:**

1. **Lift the usage-example structure into the new endpoint.** Webhook → Set (Validate Schema) → If Params Valid → your logic → success/400 Respond. Don't reinvent.
2. **Edit the IIFE for your schema.** Update `REQUIRED_SCHEMA` and the per-field checks inside the Set node's expression for your endpoint's input shape. The pattern below the schema constant is mechanical: presence check, type check, constraint check, push to `errors[]`.
3. **Leave the output shape alone.** `valid`, `validationError`, `details`, `requiredSchema` are the contract the Respond node consumes. Renaming them breaks the response body.

The full procedure, supported constraint patterns, schema design rules, and the `={{ ... }}` wrapping gotchas live in `references/API_WORKFLOWS.md` "Schema validator (Set IIFE)".

## Per-node error setup (recap)

Each fallible node needs two changes (see `references/NODE_ERROR_OUTPUTS.md`):

1. **Set `onError: 'continueErrorOutput'`** on the node config.
2. **Wire `output(1)`** to your error handler.

Both required. One without the other is the silent-failure mode.

## Self-healing on transient failures

Before wiring the error path, configure node-level retry on any node making a network call (HTTP Request, comms like Gmail/Slack/Discord, DB, AI, third-party API nodes). Transient 429s and brief upstream blips get absorbed, so the error output then only fires on real failures, and alerts and 5xx responses reflect actual problems instead of noise.

```ts
{
    retryOnFail: true,
    maxTries: 3,
    waitBetweenTries: 5000,    // ms; 5000 is the max and should be your default
}
```

Works on any node that calls a network service, not just HTTP Request. The engine retries on *any* error, with no per-status-code filter, and the engine caps `maxTries` at 5 and `waitBetweenTries` at 5000ms (`packages/core/src/execution-engine/workflow-execute.ts`). See `n8n-node-configuration-official` `HTTP_NODES.md` and `AI_NODES.md` for node-specific notes.

## Response shapes: map the cause to the status code

A 5xx response with `text/plain "Internal Server Error"` is technically 5xx but useless. And not every error is 5xx. Match the status code to *why* the request failed.

**Common mistake:** wiring every error path to a single `Respond to Webhook` returning 500 "internal_error". Every failure looks the same to the caller, even when they sent bad input. Breaks monitoring: you can't distinguish real outages from bad caller input.

**Default mapping by cause:**

| Cause | Status | Error code | Path |
|---|---|---|---|
| Required field missing or wrong type | 400 | `validation_error` | Validate up front with the Set-based schema validator (see `references/examples/validation-subworkflow.ts` for the bare pattern and `validation-subworkflow-usage.ts` for the endpoint template), or, for trivial cases, an inline IF/Switch + dedicated 400 Respond. Don't go through error outputs. Ideally echo the schema in the response so the caller can self-correct. |
| Auth missing or invalid | 401 | `unauthorized` | Same. Check up front, return 401 directly. |
| Authenticated but not allowed | 403 | `forbidden` | Same. |
| Resource ID exists in request, doesn't in your data | 404 | `not_found` | Branch off the lookup result, not the lookup error. |
| Operation conflicts with current state (duplicate, race) | 409 | `conflict` | Detect with logic, not error output. |
| Caller exceeded rate limit | 429 | `rate_limit_exceeded` | Set `Retry-After` header. |
| Node threw and you don't know why | 500 | `internal_error` | The error-output path. |
| Third-party API errored | 502 | `upstream_error` | Error output of the HTTP Request node. |
| Workflow can't currently process (downstream down, rate-limited upstream) | 503 | `service_unavailable` | Detect via specific error, return with hint. |
| Third-party API timed out | 504 | `upstream_timeout` | Error output filtered by error message. |

**Two distinct flows:**

- **Validation failures (4xx)** are checked *upstream* of the work, via IF/Switch branches, not error outputs. Use a dedicated Respond per shape (400 missing field, 401 no auth, etc.).
- **Execution failures (5xx)** come out of error outputs ("we tried, something broke"). A single error responder for all 5xx is fine. Differentiate the body's `error` code by inspecting the failed node where useful.

**One Respond, expression-driven status code.** When the error path differs only by status code and message text (same body shape, no header/content-type changes), don't fan out to N Respond nodes via a Switch. The Respond to Webhook node accepts expressions in its `Response Code` and body fields. Compute the code inline, so one Respond node carries the whole error path.

```ts
// Response Code on a single Respond to Webhook node:
{{ (() => {
    const msg = $json.error?.message || $json.message || ''
    if (msg.includes('INVALID_ID')) return 400
    if (/429|too many/i.test(msg)) return 429
    if (/openrouter|anthropic|llm/i.test(msg)) return 502
    return 500
})() }}
```

Switch + N Responds only earn their place when responses diverge *structurally*: different headers, different body shapes, redirects, different content types. Same shape with a different number is one expression-driven Respond.

For full conventions including correlation IDs, retryable-vs-fatal flags, validation details, and rate-limit shapes, see `references/RESPONSE_SHAPES.md`.

## Workflow-level error workflows

For unattended workflows, configure the instance's error workflow (or per-workflow override) to point at a workflow that:

1. Captures the failure (workflow name, execution ID, error, stack).
2. Notifies someone (Slack, email, on-call).
3. Optionally enqueues a retry (with backoff).

Catches what per-node handling misses: timeouts, crashes between nodes, errors in unwired nodes.

See `references/ERROR_WORKFLOWS.md`.

## Reference files

| File | Read when |
|---|---|
| `references/API_WORKFLOWS.md` | Building or reviewing a webhook-trigger / respond-to-webhook workflow |
| `references/ERROR_WORKFLOWS.md` | Setting up workflow-level error catching for production workflows |
| `references/RESPONSE_SHAPES.md` | Defining the response body conventions for your APIs |
| `references/NODE_ERROR_OUTPUTS.md` | Wiring a per-node error output on individual fallible nodes |

## Anti-patterns

| Anti-pattern | What goes wrong | Fix |
|---|---|---|
| Webhook → process → respond, no error branch | Caller gets timeout or empty 500 | Wire every fallible node's `output(1)` to a Respond to Webhook |
| Single Respond to Webhook for both paths | Body shape doesn't tell caller what happened | Two Respond nodes, one per path, with explicit codes and bodies |
| Error path returns 200 with `{ "error": ... }` body | Caller's HTTP client treats it as success, so error handling never fires | Always 4xx/5xx for error paths |
| Catching errors in Code node and returning them as data | Downstream sees error-shaped data, workflow continues | Let it throw, configure `onError: 'continueErrorOutput'` and wire the error path |
| Production workflow with no workflow-level error workflow | A genuine failure goes nowhere | Set up an error workflow. See `ERROR_WORKFLOWS.md` |
| Generic "Internal Server Error" on every failure | Can't distinguish caller bug from upstream from rate limit | Structured error codes. See `RESPONSE_SHAPES.md` |
| Production node calls a flaky or rate-limited API with no `retryOnFail` | Every transient 429 or upstream blip surfaces as a 5xx, and alerts fire on noise | Set `retryOnFail: true, maxTries: 3, waitBetweenTries: 5000` on the node. See "Self-healing on transient failures" |
| 500 for everything not a 200 | Caller can't separate their bad input from your outage, so their monitoring fires on your noise | Map cause → status code. Caller issues are 4xx. |
| Switch over the error message → N Respond nodes that differ only by status code | 5 nodes for what's one Respond with an expression-driven `Response Code` | Compute the code inline in a single Respond. See "One Respond, expression-driven status code" above. |

From n8n-io/skills at 180b841, shown as plain text under its license: Apache-2.0 (permissive). The license text is in LICENSE.

View SKILL.md on GitHub at 180b841

Files

7 files, 62 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.

Skill folder on GitHub at 180b841
All 29 skills from n8n

More from n8n

  • agent-builder

    Agent Builder orchestrates the creation, modification, testing, and publishing of n8n Agents.

    Claude Code, Codex, Cursor +3 · about 2.3K tokens · pinned 6 days ago

  • data-table-manager

    This skill manages n8n Data Tables through creation, import, querying, and mutation operations.

    Claude Code, Codex, Cursor +3 · about 2.1K tokens · pinned 6 days ago

  • debugging-executions

    Debug workflow execution failures by inspecting failed nodes, re-running executions, and comparing expected versus actual values.

    Claude Code, Codex, Cursor +3 · about 2.5K tokens · pinned 6 days ago

  • instance-awareness

    This skill teaches the agent to resolve ambiguous requests by reading the instance's activity log and workflow history instead of asking the user to clarify.

    Claude Code, Codex, Cursor +3 · about 1.3K tokens · pinned 6 days ago

  • intent-recognition

    Classifies automation requests by determining which primitive owns the top-level control flow (workflow, agent, needs clarification, or out-of-scope) and…

    Claude Code, Codex, Cursor +4 · about 6.9K tokens · pinned 6 days ago

  • n8n-cli

    This skill enables agents to manage n8n workflows, credentials, executions, and instance resources via the n8n CLI command-line tool.

    Claude Code, Codex, Cursor +4 · about 2.9K tokens · pinned 6 days ago

All Backend and APIs skills
  • n8n-binary-and-data-official

    This skill teaches the agent to handle files, images, and binary data in n8n workflows, including the constraints around agent tools where binary cannot cross…

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +4 · about 1.7K tokens · pinned 6 days ago

  • n8n-loops-official

    This skill teaches the agent to use n8n's three looping mechanisms: default per-item iteration (where nodes run automatically once for each input item), the…

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +4 · about 3.3K tokens · pinned 6 days ago

  • n8n-node-configuration-official

    Configures n8n nodes correctly by fetching their live parameter shapes from the server and resolving dynamic values.

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +4 · about 1.9K tokens · pinned 6 days ago

  • n8n-subworkflows-official

    This skill guides agents to build reusable sub-workflows in n8n, which are triggered by Execute Workflow Trigger nodes and encapsulate logic for reuse across…

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +4 · about 5.7K tokens · pinned 6 days ago

  • build-workflow

    This skill builds n8n workflows using code open in your workspace, then validates and tests them before completion.

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +4 · about 1.8K tokens · pinned 6 days ago

  • nvflare-orient

    Routes NVFLARE requests to appropriate downstream skills based on user intent and preliminary source inspection findings.

    by NVIDIAOfficial publisher

    Claude Code, Codex, Cursor +4 · about 600 tokens · pinned 6 days ago

Open roles at n8n

3 open roles on the jobs board

The skills listed here are third-party software, collected from public GitHub repositories as a catalog of recent skills and provided as is. Agent Native does not write or control them and is not responsible for any harm, loss or damage caused by installing or using them. Labels and checks describe what we saw at one commit and are not a guarantee. Read a skill's files before you run it. Terms of use