Chuyển đến nội dung
Skillpedia
Lập trình chung48k · #5271

n8n-error-handling

Skill này làm gì

Công cụ này giúp đảm bảo các quy trình tự động không ngừng hoạt động một cách âm thầm khi có sự cố. Nó cho phép bạn cấu hình cách xử lý lỗi, làm cho lỗi dễ thấy và có thể khắc phục.

Khi nào nên dùng

  • ✓Khi một quy trình tự động cần phản hồi một yêu cầu (API/Webhook).
  • ✓Khi quy trình chạy tự động (không có người giám sát) cần đáng tin cậy.
  • ✓Khi bạn muốn lỗi được phát hiện và dễ sửa.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/n8n-error-handling/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/n8n-error-handling/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Cấu hình quy trình của tôi để nếu yêu cầu API thất bại thì thử lại 3 lần, mỗi lần cách nhau 5 giây.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ cấu hình từng bước (node) để khi có lỗi, thay vì dừng toàn bộ, nó gửi thông tin lỗi theo một đường dẫn thay thế. Nhờ đó, bạn có thể tạo luồng xử lý lỗi như thử lại hoặc gửi cảnh báo.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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:

  1. 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.
  2. 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 onError is "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.

…

Câu hỏi thường gặp

Điều gì xảy ra nếu tôi không dùng công cụ này và có lỗi?

Nếu một lỗi xảy ra trong quy trình chạy tự động, quy trình có thể ngừng hoạt động mà không ai nhận ra, hoặc trả về một lỗi chung chung mà không có chi tiết về vấn đề.

Đầu ra lỗi là gì?

Đây là các đường dẫn phụ mà một bước (node) trong quy trình có thể dùng để gửi thông tin khi có sự cố, thay vì chỉ dừng quá trình.

Retry là gì?

Đây là cài đặt khiến một bước thử thực hiện lại tác vụ nếu lần đầu thất bại, hữu ích cho các lỗi mạng hoặc dịch vụ tạm thời.

Chi tiết

Mô tả gốc của tác giả

Design visible, structured, recoverable n8n failures using error outputs, retries, Error Trigger workflows, and HTTP error responses.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5271
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự