Urgent.News

What's breaking now, across thousands of outlets.

Tech

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.

Read the original at dev.to →

More in Tech

나중에 다시 봐도 유용한 기술 관련 링크를 저장하기 위한 실용적인 체크리스트

개발자의 하루에는 링크가 끊임없이 쌓인다. 공식 문서, GitHub 이슈, 릴리스 노트, API 레퍼런스, Stack Overflow 답변, 마이그레이션 가이드, 모니터링 대시보드, 디자인 명세, 사내 런북까지 종류도 다양하다. 문제는 링크를 한 번 찾는 일이 아니다.

  • Store technical links with reason, version, environment, and context.
  • Categorize links as original, practical, or temporary data.
  • Double-check external links before storage for current URL and content.

¿El tamaño importa?

Al inicio de mi carrera todo lo resolvía con un VPS. Unos años después estaba convencido de que cualquier proyecto serio necesitaba microservicios, multi-tenancy y un orquestador.

  • Author builds IoT system on single VPS for constant data, risk of losing data
  • Designs multi-tenant ERP with microservices, orchestrated via ECS
  • Final stage uses containerized VPS with nginx, balances simplicity and scalability

More from Wednesday 9 September →