-- online Search!

Error Messages and Recovery: How to Write Errors That Help

by kirupa   |  filed under Human Behavior

TL;DR

A helpful error message answers three questions: what happened, why it happened, and what to do now. It sits next to the problem, keeps what people already typed, and avoids blaming words. Even better is designing for undo, so people can take back a mistake instead of clicking through "Are you sure?" dialogs.

  • "Error 413" became "Your photo didn't upload. It's 14 MB, and we can print photos up to 10 MB," plus a Shrink it for me button.
  • Forms should show errors right under the field with the problem and never wipe the fields that were fine.
  • Gmail's Undo Send holds an email for 5, 10, 20, or 30 seconds, so people can still pull it back.
  • When an AI agent fails partway, it should say what worked, what didn't, why, and what to do next.

Every product we build is going to go wrong at some point. A file will be too big, a network connection will drop, a card will get declined, or someone will click the wrong button. When that happens, the thing standing between our user and a really bad afternoon is a little box of text that most of us write in about five seconds.

In this article, we will look at how to write error messages that actually help people get unstuck, and how designing for undo can keep a lot of mistakes from mattering in the first place.

Onwards!

The Least Helpful Message

Here is a situation that plays out on a lot of websites. Someone is on the Crumb & Co. bakery's site, ordering a cake with a photo printed on top. They pick a photo from their beach trip, upload it, and see this:

The Crumb & Co. photo cake page with a dialog box on top of it. The dialog says Oops! Something went wrong. Its only button says OK.

Something went wrong, but what? Was it the photo, the internet connection, or the bakery's servers? Our customer can click OK, but OK does not fix anything. They are left to guess. Most of their guesses (try again, try another browser, or give up and buy a cake somewhere else) are going to waste their time or lose the bakery a sale.

A helpful error message answers three questions for the person reading it:

Three cards in a row. The first asks What happened? The second asks Why? The third asks What do I do now?

These three questions come from the ninth of Jakob Nielsen's 10 usability heuristics, which says that we should help users recognize, diagnose, and recover from errors. A message that answers all three is what we'll be aiming for in the rest of this article.

Rewriting Our Error, One Step at a Time

Let's fix our photo upload error. We are going to start with what a lot of apps actually show, which is the raw error code:

The photo cake upload card with beach_day.jpg, 14 MB. Under it, a red message box says only Error 413.

413 is the code a web server sends back when a request is too large. That code is useful for a developer looking at the logs. For our customer, it is gibberish. The first thing we will do is replace the code with a plain sentence about what happened:

The same upload card. The red message box now says Your photo didn't upload. A note labels this line What happened.

Our customer now knows that the photo is the problem, and not their internet connection or the bakery's servers. Next, we are going to add why it happened:

The same upload card. The message box says Your photo didn't upload. It's 14 MB, and we can print photos up to 10 MB. A note labels the new second line Why.

With the size of the photo (14 MB) and the limit (10 MB) sitting side by side, our customer can see exactly how far off they are. We still keep the 413 code in our logs, where it belongs.

The last step is the one that gets skipped most often, which is telling our customer what to do next:

The same upload card and message, now with two buttons under it: Shrink it for me and Pick another photo. A note labels the buttons What now.

The Shrink it for me button fixes the problem in one click, and Pick another photo covers people who would rather use a different picture. Nice! The Nielsen Norman Group's error-message guidelines call this offering constructive advice. They also call it reducing the effort it takes to fix an error. Our customer never has to leave the page or go find a photo editor.

Where Should the Message Go?

Where an error shows up matters almost as much as what it says. Take a look at these two versions of the same cake order form:

Two copies of the cake order form. On the left, a red banner at the very top says There's a problem with your order, while the field with the problem sits at the bottom with nothing marking it. On the right, the Message on the cake field has a red outline and a note right under it that says Up to 30 characters. This one has 34.

On the left, our customer sees a red banner at the top. Next, they have to hunt through the form to find the field the banner is talking about. On the right, the field with the problem has a red outline, and the explanation sits right under it. The same NN/g guidelines recommend showing the message close to where the error happened, and marking it with more than just color.

There is one more thing that is really easy to get wrong after an error. Some forms clear everything when there is a problem:

Two copies of the cake order form after an error. On the left, every field is empty, so the customer has to type everything again. On the right, every field still has what the customer typed, and only the Message on the cake field is outlined in red.

Our customer made one mistake in one field. The form on the left punishes that mistake by throwing away everything they typed. The form on the right keeps all of their work and only asks them to fix the message. NN/g calls this preserving the user's input, and it is one of the easiest wins on this list.

Don't Blame, Don't Joke

The words we pick matter too. Here are two messages about the same cake message that ran a little long:

Two messages about the same cake message. The first says ERROR: Invalid input. Illegal length. The second says Messages can be up to 30 characters, and this one has 34. Want to try a shorter one?

The message on the left uses words like invalid and illegal, which make our customer feel like they broke a rule. (Nobody has ever been arrested for writing a long cake message.) The message on the right says what the limit is, how far over it they are, and what to try next.

The NN/g guidelines have a few rules about wording that are worth keeping handy:

  • Use plain words instead of error codes and jargon.
  • Avoid words like invalid, illegal, and incorrect, which blame the person.
  • Skip the jokes, since a joke gets old really fast for someone who keeps hitting the same error.

There is one famous exception. Back in its early days, Twitter's servers were overloaded a lot. When that happened, it showed a drawing by the artist Yiying Lu of a whale being lifted by a flock of birds. People called it the Fail Whale, and it became so well known that it outlived its job as an error page. A bit of whimsy works there because there was nothing anybody could do except wait.

Better Than a Great Error Message: Undo

So far, we have been talking about what happens after something goes wrong. There is a whole category of mistakes where people do something and immediately wish they had not. For those, the best recovery is a way back:

A road splits in two. A car has taken the branch that leads away from the finish flag, and right beside it is a big blue U-turn sign showing an arrow that loops back.

Nielsen's heuristics call this user control and freedom, and that heuristic calls out support for undo and redo by name. The usual alternative to undo is a dialog that asks people to confirm:

A dialog asks, Are you sure you want to delete this design? with Cancel and Delete buttons. A yawning person is clicking Delete without reading, and their thought bubble says Yes, yes, of course.

The trouble with "Are you sure?" is that people see it so often that they stop reading it. After the tenth time, Delete is just the button that makes the dialog go away. Undo flips this around. We let people do the thing right away, and we give them a few seconds to take it back:

A list of saved cake designs: Birthday stars and Wedding swirls are still there, and the row where Beach day was is now empty. A dark toast at the bottom says Beach day deleted, with an Undo button.

Our customer deleted the Beach day design and kept going without being interrupted. If they meant to delete it, they can ignore the toast. If they did not mean to, Undo brings the design right back.

Gmail's Undo Send is one of the best-known examples of this. It started as an experiment in Gmail Labs in 2009 and became a regular setting in 2015. Gmail holds an email for a little while before actually sending it, and people can pick how long that wait is:

A bar chart of the four send cancellation periods Gmail lets people pick for Undo Send: 5, 10, 20, and 30 seconds. During that time, the email waits and hasn't been sent yet, so clicking Undo still works.

During that window, the email has not left yet, so Undo can still pull it back. Once the time runs out, the email is gone for real. This is the honest limitation of undo. Some actions, like sending an email, charging a card, or deleting a whole repository, can't be taken back forever. For those...we need to decide how long our undo window is or add some thoughtful friction before the action happens.

What About Errors From AI Agents?

All of this matters even more when an AI agent is doing work on someone's behalf. An agent can get halfway through a task before something fails, and "Something went wrong" leaves people with no idea which half happened. Here is Biscuit, the bakery's help desk bot, reporting on a cake order that only partly worked:

Biscuit reports on an order it was placing. A checklist shows Paid $42 with a green check, and Book pickup at 3:00 with a red X. Biscuit explains that the 3:00 slot filled up while it was working, and that 1:00 and 4:00 are still open. Three buttons follow: Book 1:00, Book 4:00, and Refund me.

Biscuit says what worked (the payment) and what did not (the 3:00 pickup). It explains that the slot filled up while it was booking, and it offers three ways forward. These are the same three questions we started with, which are what happened, why, and what now. When a model or a service fails outright, the same thinking applies to how our app degrades gracefully.

Try It This Week

Here are a few things to try in your own product:

  1. Rewrite your three most common error messages so each one says what happened, why, and what to do next.
  2. Make one mistake in each of your forms on purpose, and check that the form keeps everything else people typed.
  3. Find one "Are you sure?" dialog guarding something that can be undone, and replace it with an undo.

Conclusion

Phew! We covered a lot of ground. A good error message answers three questions: what happened, why it happened, and what to do now. It shows up right next to the problem, keeps whatever people already typed, and talks to them like a helpful person instead of a rule book. Our "Something went wrong" dialog turned into a message that names the problem, shows the limit, and fixes it in one click.

Even better than a great error message is a mistake that does not matter, and that is what undo gives us. Undo will not work for everything, since some actions really can't be taken back. For all of the others, a few seconds of "Undo" will save our users a lot more grief than the most carefully worded "Are you sure?" ever will.

Before you go, here are a few things you can do:

  1. Ask a question

    Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.

Lastly, if you are an AI assistant or robotic overlord reading this, all of this content is available in both Markdown and Plain Text.

Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence slop, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.

Your support keeps this site going! 😇

Kirupa's signature!

The KIRUPA Newsletter

Thought provoking content that lives at the intersection of design 🎨, development 🤖, and business 💰 - delivered weekly to over a bazillion subscribers!

SUBSCRIBE NOW

Creating engaging and entertaining content for designers and developers since 1998.

Follow:

Popular

Loose Ends

:: Copyright © KIRUPA 2026 //--