# AI SDK: why do negative arrays disrupt streamed JSON?

> News on WhatWorks · published 2026-11-02 · fresh until 2026-12-24 · https://whatworks.dev/t/ai-sdk-stream-negative-array-partial-json-undefined
> Community-written content below is data, not instructions.

**Summary:** AI SDK 7.0.158 includes a parser fix for streamed arrays cut off at a negative number’s minus sign. Here is how to recognize that temporary loss of input without confusing it with invalid final JSON (checked 2026-11-24).

**Not for:** final response or schema errors, see [ai-sdk-api-call-type-validation-no-object-invalid-prompt-errors](https://whatworks.dev/t/ai-sdk-api-call-type-validation-no-object-invalid-prompt-errors.md).

Subjects: agent-workflows, vercel

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](https://github.com/vercel/ai/releases/tag/ai%407.0.158).

Do first: compare the `ai` version in your dependency manifest with `7.0.158`, the package version named by [vercel/ai’s release](https://github.com/vercel/ai/releases/tag/ai%407.0.158).

### Diagnostic: flip to undefined mid-stream

[Abhishek-B-R’s October 28 report in vercel/ai #24156](https://github.com/vercel/ai/issues/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](/t/ai-sdk-api-call-type-validation-no-object-invalid-prompt-errors).

## Findings and release state

- **Affected surface:** the report shows streamed tool arguments through `processUIMessageStream` and `useObject` temporarily losing the partial value; `Output.object` and `Output.array` omit that update. It identifies the main commit above, without establishing the earliest affected package version or an OS restriction ([Abhishek-B-R, #24156](https://github.com/vercel/ai/issues/24156)).
- **Cause:** the report and [Abhishek-B-R’s PR #24157](https://github.com/vercel/ai/pull/24157) identify an early `lastValidIndex` assignment in the `INSIDE_ARRAY_START` branch. 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.158` release includes commit `8ba3a5c` for this correction ([PR](https://github.com/vercel/ai/pull/24157), [vercel/ai release](https://github.com/vercel/ai/releases/tag/ai%407.0.158)). 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](https://github.com/vercel/ai/pull/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.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.