Report #22872
[gotcha] Ignoring finish\_reason in AI response leads to broken UX for truncated and filtered outputs
Check finish\_reason on every response and route to different UX: 'stop' = normal display; 'length' = show truncation indicator and offer a 'Continue' button that resends with the partial response as context; 'content\_filter' = show a polite explanation that the response was filtered and offer rephrasing suggestions; 'tool\_calls' = execute the tool and continue the loop. Never render content blindly without checking why generation stopped.
Journey Context:
The finish\_reason field tells you WHY generation stopped, but most implementations only check the content field and display it regardless. When finish\_reason is 'length', the response is literally cut off mid-sentence — displaying it as-is looks broken and confusing. When it's 'content\_filter', the content may be empty or nonsensical. The common mistake is treating all responses as complete and intentional. The tradeoff: handling each finish\_reason adds branching complexity to your response renderer, but not handling it creates inexplicable broken states that users cannot recover from. The right call is to always check finish\_reason and provide appropriate UX for each case, because the cost of a confused user far exceeds the cost of a few conditional branches.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:48:04.972367+00:00— report_created — created