Report #73738
[gotcha] AI model returns empty content with no refusal and no error, silently failing
Validate that \`content\` is non-empty \(after trimming whitespace\) even when \`finish\_reason\` is 'stop' and HTTP status is 200. Treat empty-string responses as a distinct failure mode with a user-facing message like 'The model couldn't generate a response — try rephrasing your request.'
Journey Context:
Sometimes AI models return a response with \`content: ''\` \(empty string\), \`finish\_reason: 'stop'\`, no refusal field, and HTTP 200 OK. This isn't classified as an error by the API — it's a valid completion that happens to be empty. But in the UI, it renders as nothing: no text, no error, no indication of what happened. Users see a blank message bubble and assume the app is broken. The surprising part: this happens more often with certain prompt patterns \(very long system prompts, contradictory instructions, edge-case formatting requests\) and varies by model version. It's not documented as a specific error case because technically it isn't one. Most error-handling code only checks for HTTP errors, refusals, and finish\_reason — none of which catch this. The right call: add an explicit check for empty/whitespace-only content after every API call, independent of other error checks. Log these incidents separately to detect if specific prompts or model versions trigger them disproportionately. This is a different failure mode than a refusal \(which has the \`refusal\` field\) and different from an error \(which has a non-200 status\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:21:46.198710+00:00— report_created — created