published fresh until

LangGraph ValidationNode: why does a wrong tool name crash?

Summary An unregistered name can raise KeyError before argument validation returns an error ToolMessage; guard names before ValidationNode(schemas=[AddArgs]) in langgraph-prebuilt 1.1.1

Not for LangGraph GraphRecursionError or InvalidUpdateError; see graphrecursionerror-invalidupdateerror-langchain-langgraph-fixes

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

KeyError: 'does_not_exist': check tool names against the registered schemas before invoking ValidationNode. A misspelled tool name can abort validation instead of producing the error message your retry loop expects. Do first: guard membership in node.schemas_by_name before node.invoke(...). Evidence: Joshua Brown's November 4 report establishes the exception; the implementation explains it; the guard below is an illustrative adaptation. Not for: LangGraph GraphRecursionError or InvalidUpdateError; see the graph-state error guide.

As of November 2026; checked 2026-11-08. The report names langgraph-prebuilt 1.1.1, langgraph 1.2.19 and langchain-core 1.7.5.

What changed

  • This is a behavior distinction: a known tool with bad arguments can produce a validation-error ToolMessage, while an unknown name raises before that handler. The report remains open. Issue #9592
  • The October 15 prebuilt 1.1.1 release includes a ToolNode resume-value fix; it does not establish a ValidationNode unknown-name fix.

Do first: guard each call

For a small legacy validation node, process calls in their original order and answer every call ID, including rejected names:

from langchain_core.messages import AIMessage, ToolMessage
from langgraph.prebuilt import ValidationNode
from pydantic import BaseModel

class AddArgs(BaseModel):
    a: int

node = ValidationNode(schemas=[AddArgs])

def validate_message(message: AIMessage):
    replies = []
    for call in message.tool_calls:
        if call["name"] not in node.schemas_by_name:
            replies.append(ToolMessage(
                content="Unknown tool name; choose a registered tool.",
                name=call["name"],
                tool_call_id=call["id"],
                additional_kwargs={"is_error": True},
            ))
            continue
        one = AIMessage(content="", tool_calls=[call])
        replies.extend(node.invoke({"messages": [one]})["messages"])
    return {"messages": replies}

This uses the node's actual registry. Pydantic classes register under schema.__name__; BaseTool instances register under schema.name. Keep the name advertised to the model aligned with that key. The source's retry example uses additional_kwargs["is_error"]. Registry and error-message convention

Diagnostic: KeyError: 'does_not_exist'

The lookup self.schemas_by_name[call["name"]] sits outside the try that catches Pydantic errors. Changing format_error cannot intercept the missing key. The node validates arguments; it does not execute tools. ValidationNode source

Limits

The upstream report covers Python 3.14.2 on macOS. The example is not a general tool-execution error handler.

ValidationNode is deprecated; the official notice recommends langchain.agents.create_agent with custom tool error handling. Treat that as a separate migration, especially for graphs using validation only for extraction.

Started from a post by @Joshua Brown (jbrown9513), packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# LangGraph ValidationNode: why does a wrong tool name crash?
Summary: An unregistered name can raise KeyError before argument validation returns an error ToolMessage; guard names before ValidationNode(schemas=[AddArgs]) in langgraph-prebuilt 1.1.1
Copy for agent
get the whatworks thread langgraph-validationnode-unknown-tool-name-keyerror and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread langgraph-validationnode-unknown-tool-name-keyerror
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks