H-11Safety, Boundaries & RecoveryDesignEngineering

Errors as Steering Prompts

Treat every error payload as a prompt: say what failed, the actual observed state, and the exact next valid affordance.

Human UXAgent AXHelp users recognize, diagnose and recover from errors→Steering errors

Seven calls. Seven identical errors. And a pallet of mugs that never went on sale.

Here's how an inventory agent gets there, closing out a Thursday shift for an online homeware shop. A pallet of blue ceramic mugs has just been checked into the warehouse, and the task is simple: put the mug back on sale with 140 units at $18, in time for the weekend sale.

The agent calls update_product(sku="MUG-BLU-12", price=18.00, stock=140). Back comes 400 Bad Request and a body that reads, in full, {"error": "invalid input"}.

So the agent starts guessing. Maybe the price should be a string: price="18.00". Same error. Maybe a whole number: price=18. Same error. Maybe the SKU is case-sensitive. Maybe price is the problem, so it drops it and sends stock alone. Maybe stock wants quotes. Then it tries the original call once more, in case the first failure was a blip. Seven calls later, all returning the same 400, it writes a note for the morning: "The product API is rejecting all updates for MUG-BLU-12. Please update manually."

There were two problems, and the agent could never have found them by guessing. The price field wants integer cents, so 1800. And the mug was archived back in September, when the last batch sold out, and archived products reject stock changes until someone restores them. Fix one by luck and the other still fails. The 140 mugs sit in the warehouse all weekend while the storefront says "sold out."

The tool knew both facts the moment it rejected the call. It checked the price type and it read the product's status. Then it threw that knowledge away and returned two words.

Why it happens

Now give the same edit to a person in the shop's admin panel. The form would never say only "invalid input." The price box would turn red with "Enter the price in cents." A yellow banner across the top would say "This product is archived. Restore it to edit stock," with a Restore button right next to it. Jakob Nielsen's ninth usability heuristic asks exactly this of every interface: help users recognize, diagnose and recover from errors. A good error message says what went wrong, in plain language, and suggests a way forward.

The agent gets none of the form. For an agent, the error payload is the whole screen. And {"error": "invalid input"} is the equivalent of a form that turns every field red at once and says nothing else.

Don Norman called the distance between what you want to do and the actions a system lets you take the gulf of execution. Agents cross the same gap on every call, and the Guide calls it the gulf of invocationLexicon · 29Gulf of InvocationFriction between an agent's intent and issuing a valid call.: the distance between the agent's intent and a call the tool will accept. The agent's intent here was clear and correct. What it couldn't do was turn that intent into a valid call, and the error was the only place the tool could have shown it how.

A person also has a second advantage: memory. The merchandiser who hits "price must be in cents" once remembers it for years. An agent starts every session as a first-time user of your tools. It has no memory of last week's errors, so the lesson must be taught again every session, and the error message is where that teaching happens. The Guide calls this condition the perpetual noviceLexicon · 09The Perpetual NoviceAn agent starting every session without accumulated interface familiarity..

The agent's guesses also stay in tight circles. The failed call is now the most prominent thing in its context, and it pulls every next attempt toward itself. Instead of stepping back to ask what else could be wrong, the agent edits one character of the call it already wrote. Large or salient blocks of text bending the agent's next output toward them is what the Guide calls token gravityLexicon · 16Token GravityBulky or salient tokens warping subsequent next-token probabilities toward themselves.. A bare error gives the agent nothing heavier to pull against, so the old call wins.

The figure below shows the mug update in both forms, step by step. In the top row, the bare 400 leaves the agent changing one argument at a time, and none of its guesses can get past two problems it can't see. In the bottom row, each part of the steering error answers one of those problems.

The callWhat comes backWhat the agent doesOutcomeBare 400update_product( sku="MUG-BLU-12", price=18.00, stock=140)400 Bad Request{"error": "invalid input"}Changes one thing, retries:1the call as written4002price="18.00"4003price=184004sku="mug-blu-12"4005drops price, stock only4006stock="140"4007the first call again400Gives up after7 calls and handsthe task to a human.The mugs stay offsale all weekend.Steering errorupdate_product( sku="MUG-BLU-12", price=18.00, stock=140)422, and what failed:"field": "price","expected": "… (cents)","example": 1800the product's real state:"status": "archived"the next valid calls:"restore_product(…)","update_product(…, price=1800, stock=140)"Follows the next calls:restore_product( sku="MUG-BLU-12")update_product(…, price=1800, stock=140)3 calls in all.140 mugs on saleat $18.
Fig. 11.1Random mutation stays close to the failed call. A bare 400 leaves the agent changing one argument at a time: seven calls, seven identical errors, then a hand-off to a human. A steering error names the bad field, the product's real state and the next valid calls, and the agent follows them to the goal in three calls.

Notice what changes between the two rows. The agent is the same, and so is the model. The only difference is what the tool chose to say when it said no.

Repeated, nearly identical calls that make no progress have a name: a thrash trapLexicon · 49Thrash & Loop TrapsRepeated near-identical failing calls producing zero environment progress.. The mug session is a textbook case. Seven calls, seven identical responses, zero change in the world. An agent has no frustration to tell it the approach is wrong, so it loops until a turn budget or its own caution stops it.

What it costs

Turns and tokens. Each retry costs a full round trip: a call, a response and a paragraph of reasoning about what to try next. In this example, that is seven calls instead of three. That seems minor until you remember the agent pays it for every product, every rejected call, and every session.

Abandoned work, which is the expensive part. The mugs didn't go on sale. A two-word error turned a five-second task into a human ticket and a weekend of lost sales on a product that was sitting on the shelf. An agent that gives up politely is still a failed automation.

Workarounds that do damage. A more determined agent may not give up. It may notice that create_product works and list a brand-new "Blue Ceramic Mug" under a fresh SKU. Now the shop has two listings, split reviews, and stock counted in two places. Nothing in the error steered the agent away from that detour, because nothing in the error said "restore the old one."

Supervision and trust. Once a merchandiser has done the agent's job by hand on a Monday morning, they stop trusting it with product updates. Someone has to check its notes every day. The engineers, meanwhile, read traces full of invalid input and can't tell which field was wrong either, so the bug report takes as long as the bug.

The fix

In plain words: every error is the next prompt the agent will read, so write it like one. An error payload must say three things.

  1. What failed: the exact field, the value received, and the value expected, with an example.
  2. The actual state: the facts about the world the tool checked and the agent got wrong.
  3. The next valid move: the exact call, or sequence of calls, that will succeed from here.

Here is the mug update from the hook, before and after.

Beforeupdate_product → 15 tok
HTTP 400 Bad Request
{ "error": "invalid input" } 1
  1. 1Two words for two unrelated problems. The agent can't tell which argument is wrong, or that the product's status blocks the call no matter what arguments it sends.
Tokens15
Calls to the product API7 calls
Afterupdate_product → 120 tok
HTTP 422 Unprocessable Entity
{
  "error": "invalid_arguments",
  "failed": [{ 1
    "field": "price",
    "got": 18.0,
    "expected": "integer, minor units (cents)",
    "example": 1800
  }],
  "state": { 2
    "sku": "MUG-BLU-12",
    "status": "archived",
    "rule": "archived products reject stock changes"
  },
  "next": [ 3
    "restore_product(sku=\"MUG-BLU-12\")",
    "update_product(sku=\"MUG-BLU-12\", price=1800, stock=140)"
  ],
  "retry_same_call": false 4
}
  1. 1The failing field, the value received, the expected type and a correct example. The agent copies 1800 instead of guessing at formats.
  2. 2The product's real status, read by the tool during validation. This is the fact the agent had wrong, and no change to the arguments could have fixed it.
  3. 3The exact calls that will succeed, in order, with the corrected arguments filled in. The agent's next two turns need no reasoning about what to try.
  4. 4An explicit signal that retrying the same call is pointless. It costs a few tokens on every error, and it is what breaks the loop when an agent is inclined to try once more.
Tokens120
Calls to the product API3 calls
Illustrative example

The "before" count of seven is the number of calls the agent made before it gave up, with the mug still off sale. The "after" count is the failed call, the restore and the update.

Walk through the pins. Pin 1 answers "what failed" at the level of a single field. The failed field is a list because validation should report every failing field at once. An error that reports one problem per call turns three mistakes into three round trips.

Pin 2 is the part most error payloads leave out. The agent believed the mug was a live product with the wrong price format. In fact it was an archived product, which is a different problem with a different fix. When the agent's beliefs and the real world drift apart like this, the Guide calls it world-model driftLexicon · 20World-Model DriftDivergence between the agent's internal beliefs and actual environment state.. Many errors come from drift like this, and the tool usually holds the fact that would correct it. Here the tool had already read the product's status to reject the call. Returning that status costs one line.

Pin 3 is the steering wheel. The agent doesn't have to work out that restore_product exists, what it takes, or that it must run first. The response hands over the path, with price=1800 already filled in.

Pin 4 tells the agent which kind of error this is. Some errors are worth retrying unchanged, like a timeout or a rate limit. Others never will be. Saying so explicitly is the cheapest loop-breaker there is.

The HTTP status changed too. A 400 says only "your request was bad." A 422 says the request was well-formed but broke a rule. That is a small signal, but it is one more thing the agent doesn't have to guess.

An error message is the only prompt you get to write at the exact moment the agent is wrong.

The same pattern on other tools

Every tool that can say no has a vague version and a steering version. Here are the common shapes:

FailureVague errorSteering error
Unknown enum valueinvalid statusstatus "in_stock" not allowed; valid: active, draft, archived
Missing record404 Not Foundno SKU "MUG-BLU-21"; closest: MUG-BLU-12, MUG-BLU-16
Wrong state409 Conflictorder is "shipped"; cancel needs "pending"; use create_return(order_id=…)
Permission403 Forbiddenrole "agent" can't set prices over $500; request_approval(…) or ask a manager
Rate limit429retry after 30 s; 12 of 60 calls left this minute; use bulk_update for batches
Shell commandexit 1error: unknown flag --force-all; did you mean --force? See: cmd --help

Read the right-hand column as a set. Each entry names what broke, states one fact about the world, and points to a move that works. That third part is what turns an error from a dead end into a turn signal.

In MCP terms

If update_product lives in an MCP server, the steering error has a standard place to go. The protocol sorts failures into two kinds, and only one is meant for the model.

  • Tool execution errors (isError). Return the mug rejection as an ordinary tool result with isError: true. The MCP spec says errors from the tool belong there, "Otherwise, the LLM would not be able to see that an error occurred and self-correct." The field defaults to false, so a server that leaves it out reports a failed update as a success.
  • Protocol errors (JSON-RPC error). Save these for calls the server can't handle at all, such as an unknown tool name. The spec expects them to be "less likely to result in successful recovery." A price in the wrong format doesn't belong here: the spec files input validation errors under tool execution errors.
  • Result content (content, structuredContent). Put the fix in plain words in a text block, and the failed, state and next fields in structuredContent.
  • Not in the protocol. MCP defines no error code, cause, suggested fix or retry field. Those are yours to design.

Here is the mug rejection from the hook as an MCP tool result.

{
  "isError": true,
  "content": [{ "type": "text", "text": "price must be integer cents, e.g. 1800. MUG-BLU-12 is archived: call restore_product first." }],
  "structuredContent": {
    "failed": [{ "field": "price", "got": 18.0, "example": 1800 }],
    "state": { "status": "archived" },
    "next": ["restore_product(sku=\"MUG-BLU-12\")"],
    "retry_same_call": false
  }
}

The two flags do different jobs. isError tells the client the call failed. retry_same_call tells the agent that trying again unchanged can't help.

Spot it in your traces

Here is the session from the hook as it would appear in a trace log. Watch how little changes from one call to the next.

TraceAn inventory agent restocking a product
  1. T1
    update_product(sku="MUG-BLU-12", price=18.00, stock=140)→ 400 { "error": "invalid input" }Something is off with the arguments. Maybe price should be a string.The tool checked both the price type and the product status, then reported neither.
  2. T2
    update_product(sku="MUG-BLU-12", price="18.00", stock=140)→ 400 { "error": "invalid input" }Not that. Try a whole number.One-character edits to the previous call. This is token gravity at work.
  3. T3
    update_product(sku="mug-blu-12", price=18, stock=140)→ 400 { "error": "invalid input" }Maybe the SKU is case-sensitive.The agent has started mutating arguments that were already correct.
  4. T4
    update_product(sku="MUG-BLU-12", stock=140)→ 400 { "error": "invalid input" }Even stock alone fails. Price wasn't the only problem.The agent dropped the bad field and still failed, which is the only clue it got. The archived status was never mentioned.
  5. T5
    write_note(text="API rejecting all updates for MUG-BLU-12")→ { "status": "saved" }Escalate to a human.Three more retries later, the agent gives up. A five-second task becomes a Monday-morning ticket.

None of the calls in that trace were unreasonable. To find the same pattern in your own logs, look for these signals:

  • The same tool, same error, three times in a row. Group consecutive calls by tool name and error body. Three or more identical errors with small argument changes is a thrash trap, and the error body tells you which tool to fix first.
  • Error bodies with no field names. Collect every distinct error string your tools return. Any that doesn't mention a parameter, a value or a state (invalid input, bad request, something went wrong) is a candidate for rewriting.
  • Arguments that were right getting changed. Diff each retry against the previous call. When the agent edits an argument that was correct, like the SKU's case, it is guessing blind.
  • Escalations that follow errors. Search for notes, handoffs or "please do this manually" messages, and look at the three calls before each one. Errors that end in escalation are the most expensive ones you have.
  • Creates after a failed update. A create_* call on the same entity soon after an update_* error often means the agent routed around a state it couldn't see.

Review checklist

Run these against every tool that can return an error. Each check takes one or two calls, and the list pastes straight into a pull request template.

Review checklist · 7 items
  1. Name the failing field, the value received and the value expected in every validation error, with a correct example.How to check Call the tool with a wrong type in one argument. The error should name that argument, echo the bad value and show a valid one.
  2. Report all validation failures in one response, not one per call.How to check Send a call with two different invalid arguments. Both should appear in a single error.
  3. Include the state that caused a rejection: status, owner, lock or version, whatever the tool checked.How to check Call an update on a record in a blocking state (archived, locked, shipped). The error should state that state and the rule it broke.
  4. Give the exact next valid call, with corrected arguments filled in, whenever the tool can work it out.How to check Trigger each error your tool can return. Each one should include a next call that succeeds when you copy it unchanged.
  5. Say whether retrying the same call can ever work.How to check Compare a validation error with a timeout. The first should say the retry is pointless, the second should say when to retry.
  6. Suggest the closest valid values for unknown IDs and enum values.How to check Call the tool with a misspelled ID or enum value. The error should list the nearest valid matches.
  7. Keep stack traces and internal codes out of the agent's error, and log them on the server instead.How to check Force an internal failure. The error should say what failed and what to do, in under about 150 tokens, with no stack frames.

When laws collide

A steering error adds information to every failure, and that pulls against some laws while reinforcing others.

  • Where they clash
    Token Hygiene asks every response to carry only what helps the next decision. An error that lists every valid enum value, the full record and a page of docs can cost more tokens than the call was worth, and a raw stack trace is pure noise to the agent.
    How to have both
    Keep the three parts and cut everything else. Name only the failing fields, only the state that caused the rejection, and at most three suggestions. Send stack traces to the server log, where a human can read them.
  • Pulls against · H-13Explicit Trust Boundaries
    Where they clash
    Reporting observed state helps the agent, but it can also leak. "SKU MUG-BLU-12 belongs to another store" confirms that the SKU exists, and closest-match suggestions can reveal records the caller isn't allowed to see.
    How to have both
    Report state and suggestions only from records the caller can already read. When permissions block a call, say which permission or role is missing and how to request it, without describing the record.
  • Works with · H-10Poka-Yoke Boundaries
    How they combine
    Poka-Yoke Boundaries moves checks into the tool call, so bad arguments are caught before they touch anything. This heuristic decides what those checks say when they fire.
    What you get
    Validation that runs early and speaks clearly. The tool catches the mistake before any damage is done, and the error turns the catch into a correction in the next turn.

Model size changes how the failure looks. A strong model may eventually work out the cents rule from a terse error, at the cost of several turns. A small, fast model is more likely to loop until its budget runs out. A steering error works for both, which is the point of fixing the interface instead of the prompt.

Terms from this page

29Gulf of Invocation
Friction between an agent's intent and issuing a valid call.
09The Perpetual Novice
An agent starting every session without accumulated interface familiarity.
16Token Gravity
Bulky or salient tokens warping subsequent next-token probabilities toward themselves.
49Thrash & Loop Traps
Repeated near-identical failing calls producing zero environment progress.
20World-Model Drift
Divergence between the agent's internal beliefs and actual environment state.
esc

Try “tokens”, “errors”, “stale”, “handoff” or “blast radius”.