Topic 2 of 5 · 4 min read
Recovery paths after an AI failure
Goal: Map each failure type of a feature to a recovery path that keeps the user's input and offers a non-AI fallback.
Plan the recovery path for every failure before it happens: keep the user's input, retry only when it is safe, and offer a way to finish the job without the AI. A failed AI call should cost the user a few seconds, not their work.
Check yourself · 1 of 3
An AI feature fails with a timeout. What should happen to the text the user typed?
Why it matters
AI services fail more often than normal software: providers go down, requests time out, quotas run out, and a model sometimes returns nothing useful. If your feature is the only way to finish a task, every failure blocks the user. If the user also loses the text they typed, the failure becomes a loss of trust.
How to do it
- Keep the input. Never clear a text box, an upload or a chosen option on failure. Save a draft before the call, not after it succeeds.
- Retry safely. A retry is safe when repeating the call cannot cause a second side effect. Generating a summary twice is harmless. Sending an email or charging a card twice is not. Retry automatically only for temporary failures such as a timeout or a 429 "too many requests" response, and wait for the time the server gives in its
Retry-Afterheader. Let the user retry by hand for everything else. - Fall back in order. First try the same model once more. Then a second model or provider. Then a simpler non-AI path: a template, a plain search, a manual form.
- Degrade gracefully. If the AI part is down, the rest of the page should still work. Show the manual path and say plainly that the AI is unavailable.
- Say what changed. If you silently switch to a smaller model or a cached answer, tell the user, because the quality or freshness may differ.
Before and after
Before: The reply box clears, a red banner says "Error", and the user retypes a long customer reply.
After: The reply stays in the box. A line says "The suggestion tool is unavailable. Your draft is saved. You can send it as written or try again." The send button still works.
A recovery map is a short table you write for each feature, with one row per failure type: the cause, whether to retry, the fallback and what the user sees.
What goes wrong
- Retrying without limits, which hammers a service that is already overloaded and can run up cost.
- Retrying an action with side effects, so the customer gets two emails.
- A fallback that is worse and unannounced, such as a stale cached answer shown as fresh.
- No non-AI path, so a provider outage stops the whole workflow.
For engineers (optional)
Retry only temporary errors, back off, and stop after a few tries:
async function callWithRetry(run: () => Promise<string>, max = 3) {
for (let attempt = 1; ; attempt++) {
try {
return await run();
} catch (err: any) {
const temporary = err.status === 429 || err.status >= 500 || err.code === "TIMEOUT";
if (!temporary || attempt >= max) throw err;
const wait = Number(err.retryAfter) * 1000 || 2 ** attempt * 500;
await new Promise((r) => setTimeout(r, wait));
}
}
}
If it still throws, show the fallback path, and use an idempotency key for any call with side effects.
Examples
A recovery map for a reply assistant
Timeout: retry once automatically; if it fails again, keep the draft and offer "try again".
Rate limit: wait for the time the server asks, then retry once; show a countdown.
Provider outage: switch to the second model; if both fail, show the plain reply box and a saved-draft note.
Content block: do not retry; ask the user to rephrase and keep the text.
Cut-off answer: show what arrived, mark it as incomplete and offer "continue".
Safe and unsafe retries
Safe: "Summarise this meeting" fails with a timeout. Retrying produces at most a second summary.
Unsafe: "Draft and send the refund email" times out after the email was sent. A blind retry sends it twice. Separate the drafting step, which is safe to repeat, from the send step, which needs a confirm and an idempotency key.
Key points
- Save and keep the user's input before the AI call, so a failure never costs them their work.
- Retry automatically only for temporary failures, and never for actions that cause side effects.
- Fall back in order: the same model again, then another model, then a non-AI path.
- The rest of the product should keep working when the AI part is down.
- Tell the user when a fallback gives a lower-quality or older result.
Common mistakes
- Clearing the user's input when a call fails.
- Retrying without a limit or without waiting.
- Retrying an action that sends, charges or deletes.
- Switching to a weaker model or an old cached answer without telling the user.
Check yourself · 2 of 3
Which action is safe to retry automatically after a timeout?
Check yourself · 3 of 3
The main AI provider is down. Which design degrades most gracefully?
Practice items, not counted towards your mastery.
Start here
- People + AI Guidebook: Errors and graceful failure (opens in a new tab)DocsFree
Google's guide to error types, failure causes and how an AI product can recover from each.
- Error-Message Guidelines (NN/g) (opens in a new tab)ArticleFree
Plain rules for error text: say what happened, in human words, and offer a constructive next step.
- AI Hallucinations: What Designers Need to Know (NN/g) (opens in a new tab)ArticleFree
Why models state false things fluently and what interface choices help users catch them.
More for this topic
- 429 Too Many Requests (MDN) (opens in a new tab)DocsFree
What the rate-limit status means and how the Retry-After header tells a client when to try again.