Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
All skills/n8n error handling official/ERROR_WORKFLOWS
Reference · n8n error handling official

ERROR_WORKFLOWS

Part of n8n error handling official. Install the skill and your agent reads this page when it needs the depth.

Workflow-level error workflows

Per-node error outputs handle one node's failure. They don't catch:

For unattended workflows, this gap matters: silent failure means no alert, no log, no clue. The fix is a workflow-level error workflow: when an unhandled error escapes, n8n invokes the designated error workflow with the failure context.

What an error workflow looks like

Triggered by the Error Trigger node. Receives roughly this shape (verified against IWorkflowErrorData in packages/cli/src/interfaces.ts and ExecutionBaseError.toJSON in packages/workflow/src/errors/abstract/execution-base.error.ts):

{
  "execution": {
    "id": "...",
    "url": "...",
    "retryOf": "...",
    "error": {
      "name": "NodeApiError",
      "message": "...",
      "description": "...",
      "context": { },
      "timestamp": 1715000000000
    },
    "lastNodeExecuted": "Fetch order",
    "mode": "trigger"
  },
  "workflow": {
    "id": "...",
    "name": "Sync Stripe customers"
  }
}

The error workflow's job:

  1. Identify the failure and surface it (Slack/email/PagerDuty).
  2. Optionally enqueue retry / dead-letter logic.

Minimal error workflow

Error Trigger
  → Edit Fields (build alert message from execution + error data)
  → Slack (post to #incidents)

Or, more featurefully, fetch the actual execution to recover the input data that caused the failure:

Error Trigger
  → n8n (resource: execution, operation: get,
         executionId: {{ $json.execution.id }},
         options.activeWorkflows: true)        ← includeData=true on the API
                                               ← REQUIRES an "n8n API" credential
                                                 (Settings → API → create personal access token,
                                                  then attach via the node's Credential field)
  → Edit Fields (extract failed-node input from execution data)
  → Switch (route by severity)
      ├── high → PagerDuty
      ├── med  → Slack #incidents
      └── low  → Slack #monitoring
  → Data Table Insert (log for tracking)

The Error Trigger payload only carries the error message, the failed node name (lastNodeExecuted), and the execution URL. It does not include the input data that caused the failure. The n8n node with Get Execution + Include Execution Details: true fills that gap by hitting GET /executions/{id}?includeData=true and returning the full run data, so you can pluck the failed node's input out of data.resultData.runData[<lastNodeExecuted>][0].source (or its inputs in executionData.nodeExecutionStack for more depth).

Why it's worth the extra step:

Caveats:

Minimal is enough for most cases. The featureful version pays off in production-critical workflows where on-call time matters.

Setting it up

Set it via update_workflow setWorkflowSettings.errorWorkflow (the target workflow's ID). Validated server-side: the target must exist, be published, and contain an active Error Trigger node, else the update is rejected. Pass "DEFAULT" to clear. (n8n 2.29.0+; older instances set it in the workflow settings panel.)

What the error workflow should not do

Keep error workflows fast: parse, notify, return.

Avoiding the recursion trap

If your error workflow uses Slack and Slack is down, the error workflow fails too. n8n won't re-trigger on its own failure (no infinite loop), but the failure goes nowhere.

Mitigations:

What to put in the alert

Good notifications include:

Bad: "Workflow failed."

Good (Slack body, expression-driven, both links present):

Workflow failure: *{{ $json.workflow.name }}* (`{{ $json.workflow.id }}`)
Workflow: {{ $json.execution.url.split('/executions/')[0] }}
Failed node: `{{ $json.execution.lastNodeExecuted }}`
Error: {{ $json.execution.error.message }}
Execution: {{ $json.execution.url }}
Time: {{ DateTime.fromMillis($json.execution.error.timestamp).toISO() }}

Two links matter: the workflow link so on-call can open the editor to start fixing, and the execution link so they can see the exact run that broke. Skipping either costs a step.

A "likely cause" line is optional, but for known failure modes a hint saves the on-call ten minutes.

When error workflows fire

Fires when:

Does not fire when:

So per-node error outputs that drop errors silently (e.g., wired to a no-op Set node) will not trigger the error workflow. The error has been "handled" from n8n's perspective, even though it's been swallowed.

For unhandled errors to bubble up, don't catch them per-node unless you're actively doing something with them.

Verifying the error workflow

After setup:

  1. Build a test workflow that always fails (HTTP Request to an invalid URL with no error output wired).
  2. Run it.
  3. Confirm the error workflow fires and the notification arrives.

Catches setup mistakes (wrong workflow assigned, wrong channel, missing credentials). Do this before relying on alerting.

Drift watch

Error Trigger payload shape can change between versions. If fields aren't where this file says, check current n8n docs and update parsing.

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.