Report #71500
[gotcha] Streaming function call arguments crash UI with unparseable partial JSON
Never attempt to JSON.parse incremental function call argument deltas. Buffer all argument chunks per function\_call ID until the function call finish condition is met \(finish\_reason on the chunk, or the DONE event\). Only parse the concatenated string once complete. Show a 'Using tool...' placeholder state during buffering.
Journey Context:
When streaming with function calling enabled, the API returns argument content as string fragment deltas in each chunk. Developers naturally try to parse these incrementally for progressive UI updates — after all, content streaming works great token-by-token. But function call arguments are JSON, and partial JSON is invalid and will throw on parse. This is a classic trap because the streaming interface looks the same for content and function calls, creating a false expectation that they should be handled the same way. Content tokens are meant for incremental display; argument deltas are meant for concatenation only. The OpenAI docs explicitly show concatenation patterns, but this is easy to miss when you are used to streaming content directly to the DOM.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:35:40.068516+00:00— report_created — created