langgraph Send() to conditional edge "target not found" routing error
Fixes LangGraph routing failures where Send() or a conditional edge targets a node the graph cannot find. Covers listing registered node names, fixing typos in Send targets, adding missing nodes, and aligning the conditional edge path map. Use when a router names a node that does not resolve.
TL;DR
"Target not found" means the name inside Send("name", ...) does not match any node registered on the graph, or the conditional edge's returned name is missing from its path map. List the graph's nodes, fix the spelling, and make sure the conditional edge maps every name it can return.
Error
target not found(raised when a conditional edge or Send() routes to a node name the graph does not know)
Steps
- Print the node names the graph actually registered:
print(list(graph.nodes.keys()))Expected output: the exact list of node names. Compare it letter by letter against the string inside your Send() call.
- Fix the Send target to match exactly, including case and underscores:
def router(state):
return Send("summarizer", {"text": state["text"]})Expected output: the router's target string now matches a key from step 1. Typos like "summarize" vs "summarizer" are the most common cause.
- Make sure the target node was added to the graph before compiling:
builder.add_node("summarizer", summarize_fn)
builder.add_edge(START, "router")Expected output: the node appears in the list from step 1. A node function that exists in your file but was never passed to add_node is invisible to routing.
- If routing goes through a conditional edge, check its path map covers every name the router can return:
builder.add_conditional_edges(
"router",
route_fn,
{"summarizer": "summarizer", "reviewer": "reviewer"},
)Expected output: every string route_fn can return appears as a key in the map. A missing key routes to a name the graph cannot resolve.
- Re-run and confirm the graph reaches the target node.
Expected output: the stream shows the target node executing instead of raising.
When to use
- Routing fails with a "target not found" style error naming a node
- You recently renamed a node and routing broke
- Send() fan-out works for some targets but not others
When not to use
- The node runs but gets the wrong input (that is payload shape, not routing)
- The graph compiles fine but hangs (check termination, not node names)
- The error is about a missing edge, not a missing node
Variant phrasings
conditional edge returns a name that is not in the path map
The map is the allowlist. Add the missing name, or make the router return only mapped names.
Send() worked before a refactor, fails after
The refactor renamed or moved the node. Re-run step 1 and diff the names.
Why it happens
LangGraph resolves routing targets by exact string match against registered node names at runtime. Send() and conditional edges are just strings, so nothing at import time checks them. Any drift between the string and the registered name, a node added after the edge was defined, or a path map that omits a branch, only surfaces when that route executes.
Edge cases
- Node names are case-sensitive; "Worker" and "worker" are different nodes.
- Dynamically generated target names (f-strings) can produce names that exist in some runs and not others; log them.
- Subgraphs have their own node namespace; Send() from a parent graph cannot target a node inside a subgraph by its inner name.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_kRk2ylo9s9MDd32TRqUp4A