AI error handling in production fails in ways your normal error logging never anticipated.
HTTP error checks give you a narrow view of success or failure. AI output quality can also degrade gradually, partially and inconsistently. The model gives you an answer that looks fine but misses key context. Latency spikes but stays under timeout thresholds. Output degrades in ways your metrics don’t catch. The whole thing is properly disorienting if you came from a traditional stack.
I learned this watching AI projects fail before reaching production. The ones that make it? They fail differently. Getting AI observability and monitoring right is the prerequisite for handling errors properly. In conversations I’ve had with engineering leads at mid-size firms, the most common admission is that the team treats AI like another microservice and is then surprised when it breaks unlike one.
Why do AI errors break your usual assumptions?
When an application crashes, a stack trace can give you a concrete starting point.
Your AI hallucinates? Good luck debugging that. The thing is, the same prompt works Tuesday, fails Thursday, works again Friday. This irritates me because everyone wants a deterministic bug to chase. Longer contexts can reduce quality on some tasks. Changes in production data can also affect accuracy. HTTP error checks alone will not tell you whether either happened. The whole discipline of building reliable agents starts from this basic mismatch.
Guidance from Google’s PAIR team connects perceived errors to user expectations. When AI fails, users don’t know if they asked wrong, if the system broke, or if the task was impossible. Those boundaries need to be explained in the product.
In 2018, STAT reported that internal IBM documents described unsafe Watson for Oncology recommendations and inadequate synthetic training cases. Doctors had flagged the problems. Memorial Sloan Kettering said it believed the dangerous recommendation highlighted in the report was part of system testing and was not given to a real patient. A technically valid response still needed clinical review.
What partial failure actually looks like
November 8, 2023. OpenAI’s API went down with 502 and 503 errors for over 90 minutes.
A confidence score needs validation against actual errors. Use a cached response only when it is still correct and authorized for the user.
Applications built on their API experienced widespread failures at the same time. If your error handling assumed “the API works,” your users could have received cryptic errors with no useful next step.
Knight Capital learned this expensively. A deployment missed one of eight servers: seven processed orders correctly, while the eighth ran defective old Power Peg code. Millions of orders were routed over 45 minutes on August 1, 2012. The SEC found that Knight lost more than $460 million from the unwanted positions. The system never crashed. It just executed perfectly wrong instructions.
Your AI error handling in production needs to anticipate these partial failures: the model returns JSON that validates but contains nonsense, your embedding service times out intermittently, the vector database returns results with similarity scores all below your retrieval threshold, your guardrails catch inappropriate content but don’t tell users what they should ask instead. I keep going back and forth on which of these matters most, and the blunt answer is whichever one your particular system hits first in production.
Since I wrote this, the failure class picked up first-party acknowledgment. Anthropic’s Claude Fable 5 ships safety classifiers that can decline a request in-band: the call completes, stop_reason comes back as “refusal”, and the response may name the policy category that triggered the refusal. A status-code check reads that as success. The list above still holds; the vendors now design for it, down to a server-side fallbacks retry parameter (in beta) for the decline path.
A proof of concept can fail in production when integration testing misses relevant failure modes. Composio describes this as “Stalled Pilot” syndrome instead of the promised “Year of the Agent.” The reliability math gets worse from there. If 20 independent steps each succeed 95% of the time, and all must succeed without recovery, the whole chain succeeds about 36% of the time. Read that again. It is worse than it sounds. The acceptable failure rate depends on the task and the cost of a wrong action. Unanticipated cost, complexity, and unexpected risks pile up fast.
Let me say that better. I said above that AI fails “gradually and partially,” and that oversimplifies it. A chain can have a much lower success rate than its individual calls. The size of that gap depends on dependencies, retries and which failures the workflow can tolerate. That is why the 95% per-step number looks fine on a dashboard and brilliant in a demo, but the end-to-end agent workflow still produces a broken experience.
Degradation patterns worth building
Before I go on. Circuit breakers for AI calls. The pattern, discussed in Michael Nygard’s Release It! (2007), is simple: after a threshold of failures, stop calling the broken service. But AI needs more thought here. A circuit breaker for traditional APIs might open after 5 consecutive failures. For AI, you need to track degradation over time, not just hard failures. Circuit breakers detect persistent failures and route traffic away from failing components until health is restored. Modern frameworks like LangGraph now offer durable state. If a server restarts mid-conversation or a workflow gets interrupted, it can resume from persisted checkpoints, with replay and side effects handled by the application. A fallback offers another path during an outage, provided it has been tested for the task and is available independently.
Progressive feature reduction. When your primary model fails, use a tested fallback and explain any limitation. When that fails, use cached responses only when they are still valid and authorized. When that fails, route to human review. Google PAIR recommends paths forward from failure. Your LLM summarization fails? Show the original text. Your classification model times out? Leave the classification pending and route it for review. Your embedding search returns nothing? Fall back to keyword search.
Intelligent retry with backoff. The difference matters: retry handles transient failures, circuit breakers handle persistent ones.
Transient: network hiccup, momentary rate limit, brief service degradation. Persistent: model serving failure, quota exhausted, fundamental capability limit.
Retry transient faults with bounded backoff. Stop calling a persistently failing service. Route a capability limit to a suitable workflow or a person. The expensive mistake is retrying persistent failures until you hit timeout and waste the user’s time.
The table below is the diagnostic shortlist I use in production-readiness reviews. When consulting with companies on AI rollouts, this is usually the first artifact I hand the on-call lead. The left column is the symptom your dashboards or users surface. The middle column lists a possible cause. The right column gives a response to test against that cause.
What you observe | Possible cause | Production fix |
|---|---|---|
| Model guesses instead of asking | Required intent or context may be missing | Required-field validation upstream; reject the call before it hits the model |
| Model invents facts or structure | Facts may be ungrounded, or output constraints may be missing | Validate structure with a schema; verify factual claims against trusted evidence |
| Model answers differently each time | Sampling, changing context or model behavior may contribute | Use supported model controls and evaluate repeatability on fixed inputs |
| Model drops key details | Relevant context may be missing or hard for the model to use | Test chunking and context placement; check that summaries retain required details |
| Model answers confidently but incorrectly | The output may lack independent verification | Check evidence; calibrate review thresholds against labeled cases; route uncertain cases to a person |
| Output quality collapses at scale | Model changes, load, inputs or integration failures may contribute | Identify the cause; test an approved fallback, narrower task or valid cache |
Some fixes are small configuration changes. Others need better evidence, evaluation or workflow design. The operational job is to distinguish them before changing production.
Two of these rows aged fast. As of mid-2026, structured outputs are GA on the Claude API, so schema-enforced responses are a standard feature rather than a workaround. The temperature dial went the other direction: Anthropic deprecated temperature, top_p, and top_k on Opus 4.7 and later models, where non-default values return a 400. The advice still stands; on current Claude models, the schema route now carries the consistency work the temperature dial used to.
November 17, 2026 clarification: schema constraints control output shape; they do not replace sampling controls or verify factual consistency. Anthropic removes temperature, top_p and top_k entirely in API version 2026-10-21. Earlier API versions reject non-default values on Claude 4.7 and later models and Claude Mythos Preview.
When you want to take this further, Blue Sheen helps firms work through this.
Telling users what actually went wrong
Microsoft’s Tay chatbot was attacked within its first 24 hours. But I’d argue the real failure was communication. Microsoft said a coordinated attack exploited a vulnerability it had not anticipated. The whole thing is rubbish to look back on now.
Follow this for a second. Error messages for AI need a different approach. It is easy to cobble together generic 500-error strings and call it done. (Five hundred. The polite computer way of saying we have no idea.)
Don’t blame the user. “Invalid input” makes them feel stupid when they asked a reasonable question your model couldn’t handle. Try: “I can’t process questions about that topic yet, but I can help with…”
Explain the limitation. Air Canada’s chatbot gave wrong bereavement-fare information, and a 2024 tribunal decision ordered the airline to pay CAD 812.02 in damages, interest and fees. A confident answer can still mislead a customer; uncertainty language does not make a wrong policy answer safe. Give users somewhere to go next. Google PAIR guidance on AI error messages recommends giving users a path forward after an error. Instead of “API timeout error 504,” try “This is taking longer than expected. Try a simpler question, or I can connect you to someone who can help.”
Is that extra sentence of explanation worth writing? Every time. Your monitoring catches the error. Your message determines whether users trust you the next time.
Recovery and learning from the wreckage
This is where AI incident response becomes its own discipline, distinct from traditional ops postmortems. I’m not convinced most teams are even close to ready for it.
AI observability tools track token usage, latency, prompt-response pairs, and failure modes. Nearly 89% of respondents in LangChain’s late-2025 survey of 1,340 professionals have implemented observability for their agents, outpacing offline evaluation adoption at 52.4%. Observability without action just gives you prettier dashboards while things break. That gap is where so much engineering bandwidth gets quietly burned.
The production pattern that works: monitor, detect, act, learn.
Monitor the right metrics. Error rate matters less than degradation rate. Suppose your API returns 200s while a validated quality score falls 30%. That change needs investigation even though the HTTP checks pass. Track quality metrics like hallucination rates, relevance scores, and grounding accuracy. Not just uptime.
Detect drift before users complain. Production data differs from training data. A model evaluated on older data may perform differently after production inputs change. Set up alerts for statistical drift in input distributions and output confidence. An event-driven design can shorten detection delays when it includes suitable drift checks.
Auto-scale intelligently. The November OpenAI outage happened because routing nodes hit memory limits under unexpected load. Request cost can vary. Long prompts, long outputs and repeated tool calls can make requests very different in cost.
Learn from every failure. Reuters reported in 2018 that Amazon’s experimental recruiting tool favored men after learning from a decade of mostly male applicants’ resumes. Staff identified the bias; recruiters considered its recommendations but did not rely solely on its rankings, according to the report’s sources. The lesson is to evaluate the decisions a system makes, alongside whether its code runs. More data does not automatically fix biased examples or objectives. You need human review of outputs, not just performance metrics.
Self-healing automation. Teams can monitor their AI systems for patterns indicating impending failures: memory leaks, integration timeouts, embedding drift. Test automated responses against known failure patterns, with limits on what they may change.
I think the teams that get this right treat every failure as training data. The questions that broke your model are candidates for reviewed regression tests. Some may inform fine-tuning or a knowledge-base correction after you verify the cause, labels and permission to reuse the data.
Production AI isn’t about preventing all failures. It’s about failing with some dignity, communicating clearly, and recovering fast.
The companies that win with AI aren’t the ones whose models never fail. They’re the ones whose users barely notice when they do.



