n8n workflow fails mid-run: how do you retry without duplicate data?
Design retry-safe n8n workflows with idempotency keys, unique constraints, processing states, and rules that retry only transient failures.

An n8n workflow may create a CRM contact successfully and then fail while sending an email or updating a spreadsheet. Re-running the entire execution can create another contact, order, or transaction. The answer is not to disable retries. It is to make every externally visible side effect idempotent: processing the same request repeatedly must produce the business effect only once.
A production-ready pattern has four layers: derive a stable idempotency_key from the original event; store processing state in a shared persistence layer; enforce atomicity with a unique constraint or conditional write; and retry only transient failures within a defined budget. When the same key returns, the workflow should return the stored result or resume from a safe state rather than create another record.
Root cause
Why can re-running an execution create duplicates?
A failed workflow does not imply that every earlier side effect was rolled back.
n8n coordinates independent systems, so there is no single transaction spanning a CRM, email provider, ERP, and spreadsheet. An API may commit a write and then time out before its response reaches n8n. The workflow sees an error but cannot tell whether the operation completed. This uncertain outcome is more dangerous than a clear failure before any write occurred.




