Generated banner for N8n Error Handling Official
Generated logo for N8n Error Handling Official

N8n Error Handling Official

n8nOfficialPublished by n8n

  • Skill
  • Guidelines
  • Automation and integrations
  • Apache-2.0
  • Low risk
  • Has scripts

From the author

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 description by n8n

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a framework for implementing robust error handling in n8n workflows. It focuses on ensuring that failures in unattended, scheduled, or webhook-triggered workflows are captured, surfaced, and handled appropriately rather than failing silently. The guidelines cover per-node error wiring, workflow-level error catching, structured response mapping, and input validation patterns to ensure reliable execution and clear communication of failure states.

What it does

  • Defines patterns for wiring per-node error outputs to prevent silent workflow halts.
  • Outlines the configuration of workflow-level error workflows for capturing unhandled exceptions.
  • Provides conventions for mapping error causes to appropriate HTTP status codes.
  • Details the use of structured error response bodies for API-bound workflows.
  • Explains how to configure node-level retries for transient network failures.
  • Offers a schema validation pattern using Set nodes and IIFEs for webhook inputs.

When to use it

  • When building webhook-triggered APIs that require reliable error reporting.
  • When designing scheduled or unattended workflows where silent failures are unacceptable.
  • When integrating with third-party APIs or databases prone to transient errors.
  • When you need to distinguish between caller-side validation errors and internal execution failures.

Advantages

  • Prevents silent failures that leave callers or monitoring systems without feedback.
  • Enables structured, actionable error reporting for on-call or support teams.
  • Improves system resilience through automated retry logic for transient issues.
  • Standardizes API responses to help callers identify and correct their own input errors.

Usage examples

“How do I ensure my webhook API returns a 400 error when a required field is missing?”
The skill advises validating input upstream using an IF/Switch branch or a Set-based schema validator, then using a dedicated Respond to Webhook node configured with a 400 status code.
“What should I do to handle transient 429 errors from an external API?”
Configure the HTTP Request node with retryOnFail enabled, setting maxTries to 3 and waitBetweenTries to 5000ms to absorb transient blips before surfacing an error.
“How can I catch errors that occur between nodes in my workflow?”
Configure a workflow-level error workflow via the workflow settings, which will be triggered by an Error Trigger node if an unhandled error escapes per-node handling.
“How do I wire multiple nodes to a single error responder?”
Set each fallible node to 'continueErrorOutput', then connect their output(1) ports to a single Respond to Webhook node to centralize error reporting.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/n8n-io/n8n-error-handling-official/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip n8n-error-handling-official.zip -d .agents/skills

Documentation by n8n

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.

{
    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:

CauseStatusError codePath
Required field missing or wrong type400validation_errorValidate 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 invalid401unauthorizedSame. Check up front, return 401 directly.
Authenticated but not allowed403forbiddenSame.
Resource ID exists in request, doesn't in your data404not_foundBranch off the lookup result, not the lookup error.
Operation conflicts with current state (duplicate, race)409conflictDetect with logic, not error output.
Caller exceeded rate limit429rate_limit_exceededSet Retry-After header.
Node threw and you don't know why500internal_errorThe error-output path.
Third-party API errored502upstream_errorError output of the HTTP Request node.
Workflow can't currently process (downstream down, rate-limited upstream)503service_unavailableDetect via specific error, return with hint.
Third-party API timed out504upstream_timeoutError 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.

// 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

FileRead when
references/API_WORKFLOWS.mdBuilding or reviewing a webhook-trigger / respond-to-webhook workflow
references/ERROR_WORKFLOWS.mdSetting up workflow-level error catching for production workflows
references/RESPONSE_SHAPES.mdDefining the response body conventions for your APIs
references/NODE_ERROR_OUTPUTS.mdWiring a per-node error output on individual fallible nodes

Anti-patterns

Anti-patternWhat goes wrongFix
Webhook → process → respond, no error branchCaller gets timeout or empty 500Wire every fallible node's output(1) to a Respond to Webhook
Single Respond to Webhook for both pathsBody shape doesn't tell caller what happenedTwo Respond nodes, one per path, with explicit codes and bodies
Error path returns 200 with { "error": ... } bodyCaller's HTTP client treats it as success, so error handling never firesAlways 4xx/5xx for error paths
Catching errors in Code node and returning them as dataDownstream sees error-shaped data, workflow continuesLet it throw, configure onError: 'continueErrorOutput' and wire the error path
Production workflow with no workflow-level error workflowA genuine failure goes nowhereSet up an error workflow. See ERROR_WORKFLOWS.md
Generic "Internal Server Error" on every failureCan't distinguish caller bug from upstream from rate limitStructured error codes. See RESPONSE_SHAPES.md
Production node calls a flaky or rate-limited API with no retryOnFailEvery transient 429 or upstream blip surfaces as a 5xx, and alerts fire on noiseSet retryOnFail: true, maxTries: 3, waitBetweenTries: 5000 on the node. See "Self-healing on transient failures"
500 for everything not a 200Caller can't separate their bad input from your outage, so their monitoring fires on your noiseMap cause → status code. Caller issues are 4xx.
Switch over the error message → N Respond nodes that differ only by status code5 nodes for what's one Respond with an expression-driven Response CodeCompute the code inline in a single Respond. See "One Respond, expression-driven status code" above.

Files

LICENSE

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for describing the origin of the Work and
      reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may accept and charge a
      fee for accepting support, warranty, indemnity, or other liability
      obligations and/or rights consistent with this License. However, in
      accepting such obligations, You may act only on Your own behalf
      and on Your sole responsibility, not on behalf of any other
      Contributor, and only if You agree to indemnify, defend, and hold
      each Contributor harmless for any liability incurred by, or claims
      asserted against, such Contributor by reason of your accepting any
      such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright 2026 n8n GmbH

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
   implied. See the License for the specific language governing
   permissions and limitations under the License.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

What our scanner noticed· Low risk

  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
n8n
Publisher
n8n (Official)
Source
n8n-io/skills · skills/n8n-error-handling-official · commit 27b6b9f
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by n8n.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download n8n-error-handling-official.zip