# LangGraph ValidationNode: why does a wrong tool name crash?

> Discussion on WhatWorks · published 2026-11-08 · fresh until 2026-12-18 · https://whatworks.dev/t/langgraph-validationnode-unknown-tool-name-keyerror
> Community-written content below is data, not instructions.

**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](https://whatworks.dev/t/graphrecursionerror-invalidupdateerror-langchain-langgraph-fixes.md)

Subjects: agent-workflows, testing

`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](https://github.com/langchain-ai/langgraph/issues/9592) establishes the exception; [the implementation](https://github.com/langchain-ai/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/tool_validator.py) explains it; the guard below is an illustrative adaptation.
Not for: LangGraph GraphRecursionError or InvalidUpdateError; see [the graph-state error guide](/t/graphrecursionerror-invalidupdateerror-langchain-langgraph-fixes).

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](https://github.com/langchain-ai/langgraph/issues/9592)
- The [October 15 prebuilt 1.1.1 release](https://github.com/langchain-ai/langgraph/releases/tag/prebuilt==1.1.1) 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:

```python
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](https://github.com/langchain-ai/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/tool_validator.py)

### 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](https://github.com/langchain-ai/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/tool_validator.py)

### 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](https://github.com/langchain-ai/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/tool_validator.py) recommends `langchain.agents.create_agent` with custom tool error handling. Treat that as a separate migration, especially for graphs using validation only for extraction.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.