langchain-ai/langgraph · error · ValueError
START cannot be an end node
Error message
START cannot be an end node
What it means
Raised by StateGraph.add_edge when the destination of an edge is the START sentinel. START is the graph's virtual entry point: it has no incoming edges, so it can never serve as a target. The guard at state.py:954 checks end_key == START after start_key has already been validated, meaning the start node was accepted but the end_key argument was mistakenly set to START (typically a swapped argument order or a copy-paste from an edge ending at END). The same check exists on the parallel branch for conditional-style edge lists at state.py:975.
Solutions
- Target a real node name or END
- Model loops by routing back to the first regular node, not START
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at libs/langgraph/langgraph/graph/state.py:955 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26).
Data as JSON: /api/errors/5b7d192d0acb030b.
Report an issue: GitHub.
Appendix: source
Thrown at libs/langgraph/langgraph/graph/state.py:955
end_key: The key of the end node of the edge.
Raises:
ValueError: If the start key is `'END'` or if the start key or end key is not present in the graph.
Returns:
Self: The instance of the `StateGraph`, allowing for method chaining.
"""
if self.compiled:
logger.warning(
"Adding an edge to a graph that has already been compiled. This will "
"not be reflected in the compiled graph."
)
if isinstance(start_key, str):
if start_key == END:
raise ValueError("END cannot be a start node")
if end_key == START:
raise ValueError("START cannot be an end node")
# run this validation only for non-StateGraph graphs
if not hasattr(self, "channels") and start_key in set(
start for start, _ in self.edges
):
raise ValueError(
f"Already found path for node '{start_key}'.\n"
"For multiple edges, use StateGraph with an Annotated state key."
)
self.edges.add((start_key, end_key))
return self
for start in start_key:
if start == END:
raise ValueError("END cannot be a start node")
if start not in self.nodes:
raise ValueError(f"Need to add_node `{start}` first")View on GitHub (pinned to 38031739e5)