Skip to content

Resilience patterns · 5 of 11

Which layer owns the error?

Step 1 · The pattern

Every layer retries once

A checkout goes gateway → checkout → pricing → database. Each team gave its own calls one retry, a sensible choice on its own. Pricing has an occasional bug; checkout retries it and the user never notices.

  • request
  • error
  • retry
  • answered

In short

Which layer owns the error?: how it works and how it breaks

Retry advice usually says: retry at one layer only. That is easy for one failure you know about in advance and hard in a real call chain, where any service can fail and every team has set retries on its own calls. A better rule looks at the error itself. A service owns an error when none of its own dependencies failed while it handled the request; otherwise it is passing on someone else's failure. If each error carries that answer back up the chain, every caller can follow one rule: retry an error your callee owns, pass on an error it only passed up. The layer right above the failure retries it, wherever the failure is, and every layer above that stays quiet. The number of layers that add load for one failure, the storm radius, drops to one.

How this comes up in interviews

"Every team in a call chain has set retries on its own calls. How do you stop a deep failure from being retried at every layer without removing retries that are useful?"

Then they ask

  1. How does a service tell an error it caused from one it is passing on?
  2. What should a layer do when the error from below carries no ownership information?
  3. Why do you still need a retry budget once only one layer retries?

A strong answer covers

  • Fixed rules such as 'only the bottom layer retries' break when the failure is in the middle of the chain.
  • A service owns an error when none of its required dependencies failed while it handled the request.
  • Errors carry that answer back up; a caller retries only errors its callee owns and passes the rest on.
  • The layer next to the failure retries, wherever the failure is, so the storm radius drops to one.
  • Unmarked errors from below are treated as passed up, and a budget still caps the owning layer's retries.

Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.

On one page: the track cheat sheet.

Last updated: Engineering write-up

Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.