Report #95808
[gotcha] AI response ends mid-sentence with no error thrown
Always check finish\_reason in the completion object. If value is 'length', the response was truncated by max\_tokens — surface a 'continue generating' affordance and never treat the response as complete. For code generation, block copy and execution until finish\_reason is 'stop'.
Journey Context:
When max\_tokens is hit, the stream simply terminates. No exception, no error, no visual indicator in most UI frameworks. Users read the truncated response as complete and act on it. This is especially dangerous for code \(incomplete functions that silently fail\), JSON \(unparseable partial objects\), and step-by-step instructions \(missing final steps\). The silent nature of this failure is the gotcha — a truncated response looks identical to a completed one. Many developers assume the stream ending means the AI finished its thought.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T19:23:41.599535+00:00— report_created — created