
A safe retry policy is simple to state: retry only failures that can succeed on a second try, wait longer between attempts, and stop after a small number of tries. Retry timeouts, rate limits and server errors. Never retry a validation error — it will fail the same way every time. And before any retry, make the step safe to repeat, so a second run cannot duplicate the first.
Separate failure types
A temporary service outage differs from an invalid field or missing permission. The former may recover later; the latter usually needs a correction. Record the error category and affected step rather than treating every failure as the same event.
Read the service’s current error guidance where available. Some responses indicate a wait period or rate limit. Repeating the request immediately can worsen the problem. If the input is invalid, move it to a review queue with a concise explanation.
Define limits and spacing
Choose a maximum number of attempts and a maximum time window appropriate for the task. Space attempts according to the service’s requirements and supported platform behavior. An indefinite retry loop can create costs and hide a persistent failure.
Record each attempt without copying unnecessary private payloads into logs. After the final allowed attempt, set a clear failed or needs-review status. A record should not remain silently “in progress” forever.
Inspect actions with uncertain results
If a create request times out, first check whether the destination created the post, task, or record. Do not infer failure only from the missing response. Use a stable source reference or supported idempotency mechanism to reconcile.
For consequential actions, pause for a person when the result cannot be established safely. The cost of a delayed reply may be lower than the cost of sending the same commitment twice. This is a business decision that should be explicit in the process.
Keep failure context useful
A recovery item should identify the workflow, source reference, failed stage, time, and action needed. Include enough context to investigate, but avoid exposing secrets or sensitive full records in an alert.
Assign an owner and define whether the person corrects the input, reauthorizes the service, or confirms the destination state. “Something went wrong” is not a workable recovery instruction. Keep a link to the execution view when the platform supports it.
Test both recovery and stopping
Use fictional input and an appropriate test setup to observe a temporary failure, a validation failure, and an uncertain response. Confirm that the workflow stops at its limit and produces a review item. A retry policy is incomplete if only the successful recovery is tested.
Review costs and queue volume after the pilot. Repeated retries may indicate a deeper design issue. Use our duplicate guide and cost planner to make these consequences visible.
Example: temporary versus invalid failure
A temporary service-unavailable response may be eligible for a later bounded retry. A destination rejecting a required field needs a corrected input. Repeating that invalid request wastes attempts and may obscure the real cause.
For a timeout after a create request, inspect the destination before choosing either route. It may have completed the action. Your recovery record should explain which state is known and which remains uncertain, so the maintainer does not repeat work blindly.
Do not hide persistent errors
A workflow that eventually succeeds after many retries may still be unreliable and expensive. Track retry frequency and accepted-result cost rather than reporting only successful final runs.
The retry policy, as a table
| Failure type | Retry? | Why |
|---|---|---|
| Timeout, no response | Yes | The step may never have run at all |
| HTTP 429, rate limited | Yes — honour the Retry-After header | The server tells you when to come back |
| HTTP 5xx, server error | Yes, with backoff | A temporary problem on the other side |
| HTTP 400, validation error | No | The request itself is wrong; it will fail the same way |
| HTTP 401 or 403, auth error | No | Credentials or permissions must be fixed first |
| Duplicate delivery | No — dedupe instead | The work already happened |
A conservative starting policy
Start with 3 attempts in total — the first try plus 2 retries — and exponential backoff with jitter: wait about 200 milliseconds before the second attempt and about 400 before the third, with a random jitter added so retries from many clients do not land at the same instant, and cap any single wait at 5 seconds. Put a total budget on retries as well: a cap on attempts per hour, so one unhealthy dependency cannot flood your system with repeated calls. If the server sends a Retry-After header, follow its value instead of your own schedule — the server knows its own recovery better than you do. Keep the policy conservative until you have watched it in production; widen it only when the logs show the current limits are the problem.
Make the step safe to repeat first
A retry is only safe when running the step twice has the same effect as running it once. The way to get there is an idempotency key: a unique value for each unit of work — an order ID, a message ID, a file checksum — recorded when the work is done and checked before the work is repeated. If the same key arrives again, skip it or return the previous result. Check the key once, before the work starts, and run the retry loop inside that guard: if you check inside the loop you re-read it on every attempt for no benefit, and if you store the result before the work completes you can turn a transient failure into permanent silent data loss. One key per side effect: a deduplicated database write does not also deduplicate the email, the payment or the API call that follows it. Read how duplicate workflow actions are handled for the key pattern in practice.
When retries run out
A retry loop with no exit is an outage that hides itself. When attempts are exhausted, move the item to a dead-letter queue — a visible list holding the payload, the error and the attempt history — and notify the workflow owner. A failed automation nobody sees is worse than no automation, because everyone assumes the work happened. Add a circuit breaker for services that keep failing: stop calling the service for a while instead of hammering it, and let it recover. Then fix the cause — a retry policy cannot fix a broken credential, a wrong payload or a service that is down for the day. Write the policy down in your automation documentation so the next person can follow it, and remember providers retry from their side too — see how webhooks are retried.
Frequently asked questions
Should every failed step be retried?
No. Invalid input, authorization problems, and uncertain consequential actions need appropriate correction or inspection.
What is the best retry count?
There is no universal count. Follow service guidance and choose a bounded policy based on the task’s urgency, cost, and consequences.
Should a retry wait longer each time?
Yes. Waiting longer between attempts — exponential backoff — gives a struggling service room to recover, and adding jitter stops every client that failed together from retrying at the same instant and knocking the service over again. A flat retry interval is the most common retry mistake.
What is an idempotency key?
A unique value attached to one unit of work — an order ID, a message ID, a file checksum — that lets the system recognise a repeat. When the same key arrives again, the step is skipped or the previous result is returned, so a retry can never charge a customer twice or send an email twice.
What happens when retries run out?
The item moves to a dead-letter queue with its payload, error and attempt history, and the workflow owner is notified. From there a person decides: fix the cause and re-run it, or discard it. Nothing should fail silently.
Can a retry run the same action twice?
Yes, and that is the risk retries exist to manage. A timeout leaves the sender unsure whether the first attempt completed, and providers deliver events at least once, so duplicates are normal. Only an idempotency check makes a second run harmless.
Was this guide helpful?
Tell us what needs improving →
Your selection stays on this page. To send feedback to the publication, use our contact form.
About this publication
From OptimaFlow AI
Practical guides to AI, automation, and better everyday workflows. We use illustrative examples and original diagrams, with AI-assisted writing and illustrations.
Read our editorial approach →About OptimaFlow AI