Use this when transient errors should be retried.
Retry · Error Handling
Retry in error handling repeats a failed operation for transient problems like timeouts or HTTP 503, with a maximum count and backoff, such as until/retries in Ansible.
1. Retry transient errors (timeouts, 429, 503, connection resets).
2. Limit attempts.
3. Idempotent operations only.
4. Log attempts.
5. Escalate after final failure.
transient error → retry → success/give up
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 ambiguous target identity, stale inputs, partial success, unsafe retry, permission drift and confusing tool completion with target-evidence of the actual state, choosing the cases most relevant to failure classification, maximum attempts, backoff/jitter, idempotency/deduplication and stopping retries for permanent or ambiguous failures.
Step 2 Common mistakes Narrow the fault
- Unlimited retries.
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 transient errors like timeouts and HTTP 503.
- Limit retries and back off.
- Only retry safe operations.
- Retry wrapper with attempts — policy
- Only idempotent operations retried — safety
- Retry logging — visibility
ReferenceWhy it matters1 section · depth on demand
In depth
Retry repeats a failed operation in the hope that the cause was temporary — a network blip, a busy API, a lock held by another process. It turns many transient failures into successes without human involvement, but only if applied to the right errors and with limits.
Rules:
- Retry only transient errors (timeouts, HTTP 429/503, connection reset); never retry validation or permission errors.
- Limit attempts and total time.
- Wait between attempts, increasing the delay (exponential backoff with jitter).
- Make the retried operation idempotent, or a retry can duplicate work.
for attempt in range(5):
try:
return call_api()
except (TimeoutError, RateLimited):
time.sleep(min(60, 2 ** attempt) + random.random())
raise RuntimeError("gave up after 5 attempts")
- uri: { url: "{{ api }}/status" }
register: r
until: r.status == 200
retries: 5
delay: 10
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
The linked authority for bounded mechanics is Microsoft Azure Architecture Center — Retry pattern; documentation support is separate from observed lab/production Evidence.
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 Error Handling > Retry. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/azure/architecture/patterns/retry · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
For failure classification, maximum attempts, backoff/jitter, idempotency/deduplication and stopping retries for permanent or ambiguous failures, prefer typed fields and stable IDs over human presentation text.