Back to Workflows FAQs
HELP CENTER · FAQWorkflows1 min read

How should I prevent duplicate work when a workflow retries?

Retries are valuable when a step fails temporarily, but the same event can arrive more than once or a timeout can hide a successful first attempt. Design the workflow so repeated delivery does not create duplicate side effects.

Workflows

Give each operation a stable identity

Use an event or request identifier that remains the same across retries. Before creating a payment, ticket, notification, or record, check whether that identity has already been processed and return the prior outcome when appropriate.

Keep the check and write safe under concurrent attempts. A simple read-then-write sequence can race if two workers handle the same event simultaneously; use the atomic or uniqueness mechanism supported by the data store.

Make retries observable and bounded

Record attempt number, event identity, and final outcome without logging secrets. Distinguish transient failures from permanent validation errors so the workflow does not retry work that cannot succeed unchanged.

Set a retry limit and route exhausted work to a reviewable failure path. Provide a way to inspect and safely replay it after correction, preserving the original identity so replay does not repeat completed side effects.

Back to Workflows FAQs