One Bad Row Killed the Whole Batch: Partial-Failure Handling for n8n Loops
说明与用途
单个错误记录导致 n8n 批处理停止。解决方案是对每个项目进行错误隔离,将失败记录收集到死信列表,并报告已处理、失败、跳过和重试的数量。
问题
A single malformed record caused an entire nightly batch of lead processing to stop, leaving hundreds of good records unprocessed.
结果
The batch loop now completes fully, failures are isolated and retried individually, and reporting distinguishes between processed, failed, skipped, and retried items.
工作流
- 1. Run per-item sub-workflow or error-handling branch to capture failures without throwing.
- 2. Return success or structured failure record to the main loop.
- 3. Collect failures into a dead-letter table with business key, error, and raw payload.
- 4. Report counts of processed, failed, skipped, and retried items.
- 5. Retry only items from the dead-letter list, applying dedupe checks.
- 6. Mark retried items as done or keep them on the list if they fail again.
证据
A nightly workflow of mine processed a batch of new leads: enrich each one, score it, write it to the CRM. One night a single lead had a malformed phone field, the enrichment node threw, and the execution stopped.
First, isolate failures to the item that caused them. In n8n this means the per-item work runs where an error cannot kill the loop: a sub-workflow executed per item, or an error-handling branch that catches the failure and returns it as data instead of throwing.
Second, collect failures into a dead-letter list, not a log line. A failed item goes into a table with the item's business key, the error, and the raw payload — everything needed to reprocess it without re-running the whole batch.
Third, report four numbers, not one status. Processed, failed, skipped as duplicates, and retried.
- 记录日期: 2026-10-25T23:26:25.527Z