You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vercel AI: streamText with tools fails with "ReadableStream is locked" on ai >= 7.0.168 #26403
Since ai 7.0.168, Sentry breaks streamText calls that use tools. The call fails with TypeError: Invalid state: The ReadableStream is locked, and the caller gets no text. It happens with any tracesSampleRate, including 0, so it affects every app on these versions that has Sentry.init loaded, whether or not it traces.
Reported upstream in vercel/ai#24970. The reporter traced the failure to Sentry's ai:telemetry subscriber.
Cause:deferStreamedModelCallEnd in packages/server-utils/src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts:339 replaces result.stream with a tapped stream. Since 7.0.168, ai publishes redactTelemetryCredentials(result) on the channel instead of the result itself. When that returns a copy, the copy shares the original ReadableStream. Our tapModelCallStream locks the original and assigns the tapped stream only to the copy. streamLanguageModelCall then calls pipeThrough on the original, which is locked.
vercel-ai-orchestrion-subscriber.ts:530 replaces value.stream on doStream results the same way. I haven't checked whether that path is affected.
Upstream fix:vercel/ai#24984 (open, awaiting maintainer review) makes the redacted copy forward stream to the real result. Applying its replaceProperties change to the built 7.0.173 fixes the repro with @sentry/node 11.12.0 at tracesSampleRate1 and 0.
Our v6_v7/scenario-stream-tools.mjs didn't catch this because it uses MockLanguageModelV3, whose result has no request body for ai to redact, so no copy is made.
changed the title [-]Vercel AI: streamText with tools fails with "ReadableStream is locked" on ai >= 7.0.169[/-][+]Vercel AI: streamText with tools fails with "ReadableStream is locked" on ai >= 7.0.168[/+]on Nov 16, 2026
Activity
linear-code commentedon Nov 16, 2026
JS-4104
[-]Vercel AI: streamText with tools fails with "ReadableStream is locked" on ai >= 7.0.169[/-][+]Vercel AI: streamText with tools fails with "ReadableStream is locked" on ai >= 7.0.168[/+]