n8n-error-handling
它能做什么
这个工具可以帮你确保自动化工作流在出错时不会悄悄停止运行。你可以设置错误的处理方式,让错误变得可见,并且可以恢复。
适用场景
- ✓当自动化工作流需要响应请求(API 或 Webhook)时。
- ✓当工作流需要无人值守自动运行,并且必须保持可靠时。
- ✓当你希望故障能被及时发现,并且容易修复时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/n8n-error-handling/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“帮我配置工作流:如果 API 请求失败,就重试 3 次,每次重试之间等待 5 秒。”
每周 5 个新技能,1 分钟读完。
工作原理
它的做法是对各个步骤(节点)进行设置,让它们在出错时不直接中断整个流程,而是把错误信息发送到另一条备用路径上。这样你就可以搭建处理这些错误的流程,比如重试,或发送提醒。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
n8n Error Handling
When to Use
Use this skill for unattended workflows, webhook/API response contracts, retry design, error outputs, Error Trigger workflows, alerting, or any path where failure must be visible and recoverable.
Make retries bounded and idempotent, especially for sends, payments, and writes. Redact credentials, personal data, request bodies, and stack details from caller-facing responses and alerts; expose only the minimum diagnostic context required.
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. |
…
常见问题
如果我不使用这个工具,又出现了错误,会怎样?
如果无人值守运行的工作流出现错误,它可能会在没人察觉的情况下停止运行,或者只向调用方返回一条笼统的错误,而不说明具体出了什么问题。
什么是“错误输出”?
这是步骤(节点)可以使用的额外路径。出错时,它可以通过这些路径发送信息,而不是直接中止整个流程。
什么是“重试”?
这是一种设置,当步骤第一次执行失败时,会让它再次尝试执行任务。这对临时的网络或服务错误很有用。
详情
作者的原始描述
Design visible, structured, recoverable n8n failures using error outputs, retries, Error Trigger workflows, and HTTP error responses.
热度
- GitHub 星标
- 48k
- 排名
- #5271
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。