Skip to content

Conversation

@DongSeonYoo
Copy link
Contributor

@DongSeonYoo DongSeonYoo commented Jan 3, 2026

Background

After experiencing issues similar to #7694 (tool calls getting stuck),
I looked into the tool execution code and found another potential case
where streams could hang due to unhandled promise rejection.

Summary

Add missing .catch() handler to executeToolCall promise in runToolsTransformation.

Verification

Added test cases to verify the fix:

  • should handle error thrown in async tool execution
  • should handle error thrown in sync tool execution

Both tests confirm that:

  • Errors are properly enqueued to the stream
  • outstandingToolResults is cleaned up
  • Stream closes properly without hanging
pnpm vitest run src/generate-text/run-tools-transformation.test.ts
# 13 tests passed

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
  • I have reviewed this pull request (self-review)

Related Issues

Related to #7694 - similar pattern where unhandled error states can cause streams to get stuck

@vercel-ai-sdk vercel-ai-sdk bot added the documentation Improvements or additions to documentation label Jan 3, 2026
@DongSeonYoo DongSeonYoo changed the title docs: fix LanguageModel / EmbeddingModel typos fix: Add missing ".catch" handler for tool execution promise Jan 3, 2026
@lgrammel
Copy link
Collaborator

lgrammel commented Jan 5, 2026

will also revert typo fixes. please open a separate pr so we have clean commits

@lgrammel lgrammel merged commit ae26f95 into vercel:main Jan 5, 2026
16 of 17 checks passed
@lgrammel lgrammel mentioned this pull request Jan 6, 2026
lgrammel added a commit that referenced this pull request Jan 6, 2026
## Related Issues
Follow up from #11502

---------

Co-authored-by: Lars Grammel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants