What Is an Automatic Retry? Explained
An automatic retry re-runs a failed operation on its own, on the bet that the failure was temporary and a second attempt will succeed.
Retries are the simplest, oldest tool for handling unreliable systems. In CI they turn a class of failures from "human investigates and re-runs" into "the system handles it". But a retry is only ever a good idea against a transient failure, and applying it to the wrong kind of failure makes things worse.
The core idea
When an operation fails, an automatic retry simply tries it again, up to some limit. The implicit assumption is that the failure was transient: a temporary condition cleared and the same inputs will now produce success. For genuinely transient failures, this is enormously effective and costs only a little extra time.
When a retry helps
Retries help when the failure is environmental and self-clearing: a dropped connection, a registry returning 503, a brief out-of-memory condition on a busy runner. The operation was valid; the world just got in the way for a moment.
When a retry hurts
Retrying a deterministic failure is a mistake. A failing assertion, a compile error, or a missing environment variable will fail identically on every attempt, so retries only burn minutes and delay the inevitable red. Retrying non-idempotent side effects (a deploy that half-succeeded) can also be actively dangerous.
Making retries safe
- Cap the number of attempts so a hard failure cannot loop forever.
- Add backoff (ideally with jitter) so retries do not hammer a struggling upstream.
- Scope retries to transient error classes, not every failure.
- Ensure the retried operation is idempotent so a partial first attempt is safe.
The Latchkey angle
Latchkey self-healing managed runners apply automatic retries selectively: they retry jobs that fail on detected transient and mechanical issues such as network blips and out-of-memory kills, so a one-off blip does not fail your build, while leaving deterministic code failures to fail fast as they should.
Key takeaways
- An automatic retry re-runs a failed operation without a human.
- It helps for transient failures and hurts for deterministic ones.
- Cap attempts and add backoff to avoid hammering upstreams.
- Retry only idempotent operations to avoid partial side effects.