Report #46807
[gotcha] Content moderation filter triggers mid-stream, leaving garbled partial output with no user-facing explanation
Check for finish\_reason: 'content\_filter' in the final streaming chunk. When detected, retroactively replace the entire displayed partial response with a graceful, pre-written message. Never display the raw partial text generated before the filter fired — it may be harmful or misleading out of context. Your streaming UI must support retroactive replacement of already-rendered content.
Journey Context:
When a content filter triggers during streaming, tokens may have already been emitted to the client before the filter catches the violation. The stream then terminates with finish\_reason: 'content\_filter'. The UX disaster: the user sees a sentence that starts normally and then abruptly stops mid-word, with no explanation. Even worse, the partial text before the filter point might itself be harmful or misleading when taken out of the full context. The fix requires catching the content\_filter finish reason and replacing the entire displayed response — not appending to it — with a curated message. This means your streaming renderer must support retroactive replacement of already-rendered content, which most don't out of the box.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T09:02:18.627379+00:00— report_created — created