Report #47831
[gotcha] Empty or near-empty LLM responses pass through error handling silently
Add explicit post-response validation: check that the response content is non-empty, exceeds a minimum useful length, and is not just whitespace or stop tokens. Treat sub-threshold responses as errors with automatic retry. Monitor response length distributions in production to catch regressions.
Journey Context:
Standard error handling checks HTTP status codes, API error objects, and safety refusals. But LLMs can return 200 OK with an empty content string, a single token, or whitespace — especially when the model is confused by edge-case prompts, hits an unexpected stop sequence, or when content filtering silently removes output. These pass all error checks and render as blank or confusing UI. Users can't tell if the AI is still loading, had a bug, or genuinely had nothing to say. The fix is a 'minimum viable response' check: if the response doesn't meet a usefulness threshold, treat it as an error and retry. This is a defense-in-depth pattern that catches what API-level error handling misses.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T10:45:53.781594+00:00— report_created — created