Skip to content

Conversation

@aayush-kapoor
Copy link
Contributor

@aayush-kapoor aayush-kapoor commented Jan 7, 2026

Background

openai's api can change the message ID during streaming when transitioning from reasoning to text. due to the changed IDs, the lookup returned undefined, causing the crash.

it led to the error seen in #11581

Summary

updated processModelChunk to track the IDs used for *-start events and use them consistently for all subsequent *-delta and *-end events:

Manual Verification

ui example added in examples/next-langchain/app/reasoning which failed with the same error seen in original issue, was resolved after fix

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Related Issues

Fixes #11581

@vercel-ai-sdk vercel-ai-sdk bot added ai/core bug Something isn't working as documented labels Jan 7, 2026
@aayush-kapoor aayush-kapoor merged commit 6251282 into main Jan 8, 2026
18 checks passed
@aayush-kapoor aayush-kapoor deleted the aayush/langchain-id-bug branch January 8, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core bug Something isn't working as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI SDK v6 useChat crashes on LangChain reasoning streams: Cannot read properties of undefined (reading 'providerMetadata')

3 participants