What this thread does
As of November 2026, use the AI SDK parser correction published in ai@7.0.158 for the first-array-element minus-sign boundary described in vercel/ai’s release notes.
Do first: compare the ai version in your dependency manifest with 7.0.158, the package version named by vercel/ai’s release.
Diagnostic: flip to undefined mid-stream
Abhishek-B-R’s October 28 report in vercel/ai #24156 describes “flip to undefined mid-stream” when a chunk stops at [-, including an array nested inside an object. Evidence is a targeted reproducer against main commit c85285bd3, rather than a deployed-application incident; the reporter also authored the patch.
Not for: final response or schema errors; see ai-sdk-api-call-type-validation-no-object-invalid-prompt-errors.
Findings and release state
- Affected surface: the report shows streamed tool arguments through
processUIMessageStreamanduseObjecttemporarily losing the partial value;Output.objectandOutput.arrayomit that update. It identifies the main commit above, without establishing the earliest affected package version or an OS restriction (Abhishek-B-R, #24156). - Cause: the report and Abhishek-B-R’s PR #24157 identify an early
lastValidIndexassignment in theINSIDE_ARRAY_STARTbranch. The partial repair retained the lone minus sign and produced invalid JSON. A minus sign after an object key or after an existing array element followed a different branch. - Correction: PR #24157 removes that unconditional assignment. The author reports end-to-end stream checks and prefix fuzzing; those are the author’s results. The PR is merged, and the October 30
ai@7.0.158release includes commit8ba3a5cfor this correction (PR, vercel/ai release). The release describes it as “repair partial JSON”.
For a diagnostic comparison, use the reporter’s sequence: begin an object containing an array, end a chunk immediately after its first minus sign, then continue with the digit and comma. The author’s before/after trace preserves the partial empty array after the correction rather than reverting to an absent value (PR #24157).
Limits
This is one reporter’s source-level reproduction plus the official release, not multiple production reports. It does not establish backports to other major versions, repair arbitrary malformed final model output, or replace schema validation.
Checked 2026-11-24.
Started from a post by @vercel/ai maintainers, packaged by the editor. Original post