Topic 1 of 5 · 4 min read
Error messages that say what failed and what next
Goal: Rewrite five generic AI error messages so each names the failure, the next step and a reference id to quote to support.
A good AI error message names what failed, tells the user what to do next and gives a short reference id. "Something went wrong" does none of the three.
Check yourself · 1 of 3
An AI summary tool shows "Something went wrong" for every failure. Which change helps users most?
Why it matters
An AI feature can fail in many different ways, and the right response to each is different. If the request timed out, trying again may work. If a content filter blocked it, trying again will not. If the model found no sources, the user should widen the question. A generic message hides which case it is, so users retry blindly, give up or blame themselves. Google's People + AI Guidebook asks teams to work out the cause of each failure before they write the message.
How to do it
- List the real failure causes of your feature. Typical ones: the request timed out, the user hit a rate limit, a content filter blocked the input or the answer, no sources were found, a file was too large or unreadable, the service is down, the answer was cut off.
- Write one message per cause. Each has three parts: what failed ("The summary took too long and was stopped"), what to do ("Try a shorter document, or try again in a minute") and a reference id ("Reference: ERR-4F7K2").
- Show it where the action happened. Keep the dialog or the form open, with the user's text still in it, and put the error next to the control they used.
- Use the user's words, not the system's. NN/g advises plain language and a constructive tone. Never show a stack trace or the raw provider error.
- Do not blame. "The file is larger than 20 MB" is better than "You uploaded an invalid file".
Before and after
Before: Something went wrong. Please try again.
After: We could not find any sources for this question in your workspace, so we did not answer. Try a broader question or add the document you need. Reference: ERR-4F7K2.
The reference id is a short code that is also written to your error log. When the user quotes it, support finds the exact failed request in seconds, instead of asking for screenshots and times.
What goes wrong
- One message for every cause, so the advice is wrong half the time. "Try again" on a content-filter block sends the user in a loop.
- Showing the error later or somewhere else, such as a toast after a dialog has closed, so the user cannot tell what it refers to.
- Leaking internals: provider names, token limits or stack traces that confuse users and help attackers.
- A reference id that maps to nothing, because the failure was never logged.
For engineers (optional)
Map an internal error code to a user-facing message in one place, and always attach the request id:
const messages: Record<string, string> = {
TIMEOUT: "This took too long and was stopped. Try a shorter input.",
RATE_LIMITED: "Too many requests. Try again in a minute.",
CONTENT_BLOCKED: "This request cannot be processed. Rephrase it and try again.",
NO_SOURCES: "No sources matched. Try a broader question.",
};
function toUserError(code: string, requestId: string) {
return { message: messages[code] ?? "The request failed. Contact support.", ref: requestId };
}
The fallback line still says what to do and still carries the id.
Examples
Five causes, five messages
Timeout: The summary took too long and was stopped. Try a shorter document. Ref: ERR-91XA.
Rate limit: You have sent many requests in a short time. Wait one minute and try again. Ref: ERR-77QD.
Content filter: This request was blocked by our safety rules. Rephrase it without the flagged detail. Ref: ERR-20MC.
No sources: We found nothing in your files about this, so we did not guess. Try a broader question. Ref: ERR-5TZ1.
Service down: The assistant is unavailable right now. Your draft is saved; you can write it by hand or retry later. Ref: ERR-3B8W.
Where the message goes
A user pastes a contract into a "Summarise" dialog and the call fails. Weak: the dialog closes and a toast says "Error". Strong: the dialog stays open, the pasted text is still there, and a red line under the button says what failed and what to try.
Key points
- Every error message needs three things: what failed, what to do next and a reference id.
- Different causes need different advice, so a timeout, a rate limit and a content block need different messages.
- Show the error where the action happened and keep the user's input in place.
- A reference id is useful only if the failed request was logged under that same id.
- Use plain words and never show raw provider errors or stack traces.
Common mistakes
- Writing one catch-all message for every failure.
- Telling users to try again when the same input will fail the same way.
- Closing the dialog and showing the error somewhere else.
- Printing raw provider errors, or giving a reference id that was never logged.
Check yourself · 2 of 3
What is the main job of a reference id in an error message?
Check yourself · 3 of 3
A user submits a long form with an AI-drafted answer and it fails. Where should the error appear?
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.