Report #79967
[gotcha] Why does streaming structured output \(JSON, code, tables\) from AI break the user experience?
Buffer structured output until a complete valid unit is formed before displaying it, or render in a staging area that only becomes visible once syntactically valid. For code, wait for complete functions or at least complete executable lines. Never let users see or copy half-formed structured output.
Journey Context:
Streaming a JSON object or code block token-by-token means the user sees invalid syntax for 90% of the streaming duration. Users instinctively try to read or copy what's on screen, leading them to grab malformed output. For code, this is actively dangerous—a user might copy-paste half-formed code into a terminal or production system. The gotcha: developers test streaming with natural language where partial output is fine, then reuse the same streaming pattern for structured output without realizing the UX completely breaks. The fix requires different streaming strategies for different output types: natural language can stream freely, but structured output needs buffering. Tradeoff: this removes the 'alive' feeling of streaming for structured content, but prevents users from acting on invalid output—which is a far worse failure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:49:40.731398+00:00— report_created — created