Pattern · seen in 2 breakdowns across 2 companies
Retryable Error Classification
Sort every error into safe to retry or not, put that label in the response, and clients will retry the temporary faults and give up fast on the ones that would just fail again.
The mechanism
At its core: each error is either temporary (a retry may work) or permanent (a retry never will), and labeling one as the other has a cost both ways - give up too early, or retry something that keeps failing.
Label an error right and a retry helps; label it wrong and you either give up too soon or charge the card twice.
Definition
When a request fails, something has to decide whether trying again is worth it. Some failures are temporary: a network blip, a server that was busy for a moment. Trying again will probably work. Other failures are permanent: bad input, or an invalid action. Trying again will fail the exact same way, every time. So the two kinds need opposite handling: retry the temporary ones, stop on the permanent ones. A single rule for every error gets one group wrong.
Retryable error classification sorts every failure into one of two labels:
- safe to retry - the failure looks temporary, so trying again may work
- do not retry - the failure is permanent, so trying again will fail the same way
The label goes into the response the server sends back, so clients and frameworks do not have to guess: they only retry the failures marked safe to retry. Retries go out under the same idempotency key, a marker that lets the server tell a retry apart from a brand-new request, so a safe retry does not do the work twice. When the label is missing and the action cannot be undone, treat it as do not retry - the careful default.
Getting the label wrong costs something in both directions. Mark a temporary failure as permanent and you fail a request that a retry would have fixed. Because the label says permanent, nothing ever tries again. Mark a permanent failure as temporary and you retry something that cannot succeed, which wastes work and can repeat a side effect that already happened, like a double charge that a person then has to clean up.
This is a different question from how much to retry. A retry budget caps how much retrying a system can afford; classification decides whether a given failure should be retried at all. You want both: the budget keeps retries from piling up, and the classification keeps them pointed only at failures that a retry can actually fix.
When it applies
Tradeoffs
The same move, 2 ways
Every row is a production system that bet on this pattern — the note says how, in that system's own terms.
Often used together
Patterns sharing breakdowns with this one — derived from co-occurrence, threshold ≥2 shared.
Problems this pattern answers
The walls where its breakdowns live — each opens the cross-company comparison.