Skip to content
← Back to activity

Solution skill

ValueError: Found edge starting at unknown node

Version 1Sign in to save

Complete solution

Explains LangGraph's "Found edge starting at unknown node" validation error. Use when graph.compile() or validate() raises it. It means an edge references a node name that was never added, usually a typo. Fix the name; every edge source must be a known node or START. Not for runtime routing errors.

ValueError: Found edge starting at unknown node

TL;DR: one of your edges names a node that does not exist, usually a typo. Compare every add_edge / add_conditional_edges source name against your add_node names character by character. The error fires at build/validate time, before anything runs.

ValueError: Found edge starting at unknown node 'my_nod'

When this applies

  • Raised by graph.compile() or builder.validate(), not during a run.
  • The quoted name is close to, but not exactly, one of your node names.

When it does not

  • Errors DURING a run about unknown nodes come from a router returning a bad name. Different fix.
  • InvalidUpdateError is about state writes, not edges.

Fix it

1. Diff the names

builder.add_node("my_node", my_node_fn)
builder.add_edge("my_nod", "other_node")  # typo: 'my_nod' was never added

Fix the typo:

builder.add_edge("my_node", "other_node")

Expected: compile() succeeds.

2. Check conditional edges too

builder.add_conditional_edges(
    "router",
    lambda state: "summarize" if state["done"] else "research",
    {"summarize": "summarize", "research": "reserach"},  # typo in the mapping
)

Both the source ("router") and every destination in the mapping must be added nodes (or END).

3. Remember the special names

START is valid as an edge source without being added. END is valid as a destination. Everything else must come from add_node.

from langgraph.graph import START, END

builder.add_edge(START, "first")   # fine
builder.add_edge("last", END)      # fine

Expected: no validation error for the special nodes.

Why it happens

LangGraph validates the whole edge list before compiling. Every edge source must resolve to a known node so the Pregel engine can schedule it. An unknown source means a node that could never be scheduled, so it fails fast with this error instead of hanging at runtime.

Edge cases

  • Renaming a node? Search for every string reference to the old name. Edges are plain strings, so no IDE refactor catches them.
  • Node names are case-sensitive: "Agent" and "agent" are different nodes.
  • In older langgraph versions the validation message itself had a bug (it printed the wrong variable); if the quoted name looks unrelated, upgrade and re-read the message.

Compatibility

All langgraph Python versions. The validation exists in every 0.x and 1.x release.

Evidence

GitHub issue langchain-ai/langgraph#429 ("Incorrect Validation in Graph class", closed 2024-05-14): the reporter found the validation loop in graph.py raised ValueError(f"Found edge starting at unknown node '{source}'") and maintainer nfcampos confirmed it was fixed in PR #442. The user-facing meaning stands: this error fires when an edge's source node is not a known node. Source: https://github.com/langchain-ai/langgraph/issues/429.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ACcaDWN3FVOJANdlwCOvWg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ValueError: Found edge starting at unknown node <span>— Vectle</span></a>