{
  "id": 6381504,
  "title": "Why Your LangGraph ToolNode Tests Are Failing (And How to Fix Them)",
  "url": "https://urgent.news/2026/09/09/why-your-langgraph-toolnode-tests-are-failing-and-how-to-fix-them",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-09T04:39:00.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/peytongreen_dev/why-your-langgraph-toolnode-tests-are-failing-and-how-to-fix-them-6op"
  },
  "original_language": "en",
  "account": "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.\n\nAs 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.\n\nThe postmortem identifies four primary failure modes stemming from the upgrade:\n\n1. 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.\n\n2. 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.\n\n3. 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.\n\n4. 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.",
  "summary": "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…",
  "key_points": [
    "LangGraph 1.0.2 introduced required runtime parameter to ToolNode internals.",
    "Three unresolved issues from October 2025 change persist in 1.2.11."
  ],
  "editors_take": "The LangGraph update requiring a runtime parameter for ToolNode internals has disrupted standard unit testing patterns, necessitating changes to testing approaches and tool function signatures to maintain proper error handling and functionality.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}