Why Your LangGraph ToolNode Tests Are Failing (And How to Fix Them)
You wrote a clean unit test for your LangGraph tool. It worked fine for months. Then you upgraded your dependencies and got this: ValueError: Missing required config key 'N/A' for 'tools'. Or maybe: TypeError: custom_afunc() got an unexpected keyword argument 'runtime' Or your tests pass silently while error handling is completely off in production. You didn't change your code. The framework…
In October 2025, the langgraph-prebuilt 1.0.2 release introduced a required runtime parameter to ToolNode internals. This change was intended to support LangGraph's new execution model, but it broke standard unit testing patterns without providing adequate migration guidance or signal. Developers who performed a clean pip install after October 29, 2025, began experiencing silent failures in their ToolNode unit tests.
As of langgraph-prebuilt 1.0.8 in February 2026, three of the four issues originating from the October 2025 change remain unresolved. Issues #6397 and #6486, affecting ToolNode invocation without a runtime context and error handling defaulting to off, respectively, still exist in the current LangGraph version (1.2.11). These problems are not temporary workarounds but rather fundamental fixes required for proper tool testing.
The postmortem identifies four primary failure modes stemming from the upgrade:
1. Testing ToolNode outside the graph context. When invoking a ToolNode directly without the langgraph.runtime.Runtime context, a ValueError is thrown indicating a missing required config key "N/A" for the tools. To resolve this, developers must include a Runtime instance in their invoke calls, even if it's initialized without arguments.
2. Custom async tool functions lacking runtime parameter. LangGraph passes the runtime parameter as a keyword argument to all callable tools. If the tool's function signature does not accept this parameter, a TypeError will occur. The fix involves modifying the tool function to accept **kwargs and absorb the runtime parameter, thus ensuring compatibility with future injections.
3. Error handling regression. LangGraph's handle_tool_errors default reverted to False in 1.0.x, resulting in silent failures when tool execution encounters errors. Previously, this default was True. Developers must explicitly set handle_tool_errors to True in their ToolNode configurations to maintain the previous error handling behavior.
4. CancelledError not caught. In asynchronous execution, if a tool task is canceled due to a timeout, the CancelledError propagates uncaught, leading to flaky test behavior. To address this, developers should wrap tool implementations in try/except blocks to handle asyncio.CancelledError, ensuring cleanup code executes appropriately.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.