Report #21647
[gotcha] Streaming structured AI output causes UI flicker, render errors, or crashes from invalid intermediate JSON
Use incremental/streaming JSON parsers \(e.g. Vercel AI SDK streamObject, partial-json\) or buffer until you have complete valid chunks before rendering. Never pass raw streaming text into JSON.parse\(\).
Journey Context:
Developers stream responses for perceived latency benefits but forget that JSON is only valid when complete. Intermediate tokens like \{"name": "Al will fail JSON.parse\(\), causing React/render errors and UI flicker. The temptation is either to show nothing until complete \(defeating streaming\) or to try-catch around parse \(hiding real errors and showing nothing\). The right call is incremental parsing that builds up a valid partial state — the UI renders what it can, gracefully filling in fields as tokens arrive.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:44:49.929926+00:00— report_created — created