By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
At 09:14 your support assistant stops answering. Every ticket returns the same sentence: I could not look up that order. Nothing was deployed that morning. Three engineers open the prompt file and start rewriting instructions. Two hours later someone reads the error log and finds 401 authentication_error on every call. The key had been rotated in one region. The prompt was never the problem.
That morning was lost to misclassification, not to a hard bug. Editing a prompt feels like progress, and it hides the real signal.
This lesson gives you a taxonomy: a fixed set of classes, so the first ten minutes of an incident go to the right layer. You will meet six classes and write a classifier that names one from a log record.
Most engineers name the model. The better answer names two layers. Your tool returned a raw error, and your contract never told the model what to do with one. The model did its job and answered anyway. A classifier that stops at the model is wrong sends you to the wrong file.
A class is a group of failures that share a cause and a fix owner. Sorting a failure into a class takes one log line. Six classes cover almost every production failure in a Claude application.
| Class | How it shows up | First thing to check |
|---|---|---|
| Transport and auth | No answer came back, or it was cut short: 401, 403, 429, 5xx, a reset socket | The key, its scope, the region, and the retry budget |
| Request shape | 400 invalid_request_error before inference: a bad role order, an unknown field, a tool schema the API rejects | The payload you actually sent, not the one you meant to send |
| Model output | 200 OK, but the content breaks your schema, ignores an instruction or answers the wrong question | The text, the stop_reason, and the validator message |
| Tool | The model asks for an action, and your code, the arguments or the upstream API fails | The tool_use arguments and the tool_result you returned |
| Context | Every span is green and the answer is still wrong: a fact was missing, buried or truncated | The assembled prompt: what was dropped or cut |
| Data | The answer is faithful to a stale or wrong source | The source record and its freshness |
Read the table as a routing rule: the class decides who opens the editor. A transport failure belongs to the platform owner, a request-shape failure to whoever builds the payload, and a data failure to the source owner. Saying the class out loud stops a team from editing prompts out of habit.
Classify in code, not in memory. A short function beside your client labels every log line, so the graph you read at 09:00 already answers the first question. This snippet reads recorded records and calls no model.
# Classify a failed call before anyone edits a prompt.
# Runs on recorded records; no model is called.
RECORDS = [
{"status": 401, "stage": "send", "detail": "authentication_error"},
{"status": 429, "stage": "send", "detail": "rate_limit_error"},
{"status": 400, "stage": "send", "detail": "invalid_request_error"},
{"status": 200, "stage": "tool", "detail": "upstream_timeout"},
{"status": 200, "stage": "text", "detail": "schema_failed"},
]
def classify(record):
status = record["status"]
if status in (401, 403):
return "auth"
if status == 429 or status >= 500:
return "transport"
if status == 400:
return "request shape"
if record["stage"] == "tool":
return "tool"
return "model output"
for record in RECORDS:
print(record["status"], record["stage"], "->", classify(record))The 401 and the 400 never reached a model, so no prompt change can affect them.
The diagram turns the table into three questions. Ask them in this sequence and you cannot skip the layer that actually failed.
A 200 means the request was accepted. It does not mean the answer is right, the tool worked, or the facts are current. Three habits follow from that.
A class is useful only if it appears where you already look. Add three fields to every request log: the class, the span that produced it, and the tool name. Then chart the counts per hour. A spike in transport is a platform page. A spike in model output is a prompt or schema review. A spike in data is an ingestion ticket.
This is also how you choose what to test next: the class with the highest count gets fixtures first.
Take one failure from your own logs, or the 09:14 story above, and classify it in four lines.
Key takeaways
Classify before you fix: the class decides who opens the editor.
Six classes: transport and auth, request shape, model output, tool, context, data.
A 200 status rules out transport and auth only. It proves nothing about the content.
A model that answers over a raw tool error is a missing error contract, not a prompt bug.
Log the class, the failing span and the tool name, then chart the counts.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.