Report #50438
[gotcha] Streaming response silently truncates when content safety filter triggers mid-generation
Check the finish\_reason in the final streaming chunk. If it is 'content\_filter', discard the partial output and display a graceful refusal message. Never render raw partial text from a filtered stream.
Journey Context:
When streaming, the model can begin generating a valid response before a safety filter triggers on a later token. The stream terminates with finish\_reason='content\_filter' instead of 'stop'. Without handling this, the UI displays a half-sentence that looks like a bug — not a refusal. Developers handle the happy path \(finish\_reason='stop'\) and HTTP errors, but miss this third state where the request technically succeeded but content was filtered mid-stream. The truncated output can be nonsensical or even more problematic than whatever was filtered, because the user has no idea why the response is incomplete.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:08:36.155675+00:00— report_created — created