[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live) [AI SDK](/c/ai-sdk/62) # @ai-sdk/langchain HITL interrupt fails to match tool calls in dual streamMode 26 views · 0 likes · 2 posts Danny DW Kim (@domuk-k) · 2026-02-27 I found a bug in `@ai-sdk/langchain` when using `streamMode: ["messages", "values"]` with `LangGraph`’s `HITL` (Human-in-the-Loop) `interrupt()`. **The problem:** Tool calls emitted via `messages` stream are added to `emittedToolCalls` but not to `emittedToolCallsByKey`. When the `__interrupt__` handler tries to match by key, it fails and generates a fallback ID — causing orphaned approval cards in the UI. I’ve submitted an issue and a PR with a fix and tests. The fix is a 5-line `else-if` branch that registers the key mapping for tool calls already emitted via `messages` mode. - **Issue:** [@ai-sdk/langchain: HITL interrupt cannot match tool calls emitted via messages streamMode · Issue #12797 · vercel/ai · GitHub](https://github.com/vercel/ai/issues/12797) - **PR:** [fix(langchain): register key mapping for HITL interrupt matching in dual streamMode by domuk-k · Pull Request #12798 · vercel/ai · GitHub](https://github.com/vercel/ai/pull/12798) Would appreciate any feedback or a review. Thanks! Pauline P. Narvas (@pawlean) · 2026-02-27 Thanks so much for the detailed bug report and the PR, really appreciate you taking the time to track this down and contribute a fix for the `@ai-sdk/langchain` HITL issue! 🙏 The team will review your PR and get back to you soon. This kind of community contribution is exactly what helps make the SDK better for everyone. I'll loop back once there's movement on the PR. Thanks again for jumping in! 💪