List how the system can fail (hallucination, timeout, bad retrieval) and design guardrails before shipping.
LLM systems fail in predictable ways: hallucination, bad retrieval, malformed JSON, provider timeout, runaway agent loops, and silent cost spikes. Failure mode mapping lists these before build so you design guardrails instead of incident-driven patches.
| Failure mode | Guardrail |
|---|---|
| Hallucinated facts | RAG + citations; refuse without source |
| Wrong retrieval | Eval retrieval separately; metadata filters |
| Invalid structured output | Zod/schema validation + retry |
| Provider outage | Fallback model or graceful message |
| Runaway tool loop | Max iterations, timeouts, allowlists |
| Cost spike | Rate limits, token caps, caching |
Public assistant refuses without corpus support; copilot tools are auth-scoped and schema-validated. PostHog and Sentry feed back production failures into eval ideas — mapping continues after ship.
| Thought | Reality |
|---|---|
| "We'll harden after launch" | First failure may be public |
| "Good model won't hallucinate" | All models do under some inputs |
| "Retries fix everything" | Retries without caps multiply cost |