N8n Error Handling Official 标志

N8n Error Handling Official

组织
n8n-io
n8n-error-handling-official

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.

Add to TypingMind

概览

发布者n8n-io
代码仓库skills
技能名称n8n-error-handling-official
星标数
551
复刻数
80
附带文件
6
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 6 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 n8n-io 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 N8n Error Handling Official AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/n8n-io/skills/tree/main/skills/n8n-error-handling-official
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/n8n-io/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/n8n-error-handling-official .claude/skills/n8n-error-handling-official
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 N8n Error Handling Official,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 N8n Error Handling Official。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 N8n Error Handling Official 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

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:

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.

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

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.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

N8n Error Handling Official AI 技能有什么作用?

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.

为什么在 TypingMind 中使用 N8n Error Handling Official?

因为您只需安装一次,就能搭配任何模型使用。N8n Error Handling Official 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 N8n Error Handling Official?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/n8n-io/skills/tree/main/skills/n8n-error-handling-official。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 N8n Error Handling Official?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

N8n Error Handling Official 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 N8n Error Handling Official 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

N8n Error Handling Official AI 技能免费吗?

是的。n8n-io 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇