Use this when retrying transient failures.
Retry Logic
Retry logic reruns a failed step a limited number of times, with delays or backoff, for transient errors like timeouts. Only retry operations that are safe to repeat.
1. Retry transient failures (timeouts, 429, 503) with backoff and jitter.
2. Limit attempts.
3. Don't retry non-idempotent actions blindly.
4. Log retries.
5. Respect Retry-After.
transient error → backoff → retry → give up after N
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
The negative fixture should deliberately exercise risks such as implicit defaults, hidden dependencies, duplicate dispatch, worker drift, timeout without cancellation, retries against non-idempotent operations and confusing control-plane completion with target convergence, choosing the cases most relevant to explicit retryable error classes, attempt budget, exponential backoff/jitter, cancellation and post-timeout state checks before another mutation.
Step 2 Common mistakes Narrow the fault
- Retrying non-idempotent POSTs and creating duplicates.
- Retrying permanent errors (400, 401, 403).
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Retry only transient failures like timeouts or HTTP 503.
- Limit the number of attempts.
- Add backoff so retries do not overload the target.
- Retry with exponential backoff and jitter — policy
- Max attempts — limit
- Only retry transient errors — classification
ReferenceWhy it matters1 section · depth on demand
What it is
Retry logic repeats a failed operation when the failure is likely temporary (timeouts, 429, 503). Use exponential backoff with jitter and a maximum number of attempts, and only retry idempotent operations.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Retry logic decides which failures are retried, how many times and with what delay. Good retry logic absorbs transient problems; bad retry logic hides real failures, overloads struggling services or duplicates work.
Design:
| Decision | Recommendation |
|---|---|
| What to retry | Timeouts, connection errors, 429, 502/503/504 |
| What not to retry | 400, 401, 403, 404, validation errors |
| Attempts | 3–5 |
| Delay | Exponential backoff with jitter, capped |
| Total budget | Upper limit on total time |
| Idempotency | Required for anything that changes state |
Log each retry with the reason, and report when retries were needed even if the operation eventually succeeded — frequent retries are an early warning sign.
Example
- ansible.builtin.uri: { url: "{{ api }}/status" }
register: r
until: r.status == 200
retries: 5
delay: 10
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Automation Design > Retry Logic. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/azure/well-architected/operational-excellence/enable-automation · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
For explicit retryable error classes, attempt budget, exponential backoff/jitter, cancellation and post-timeout state checks before another mutation, prefer typed fields and stable IDs over human presentation text.