diff --git a/langgraph/graph/graph.py b/langgraph/graph/graph.py index 6595238c2..5659b5031 100644 --- a/langgraph/graph/graph.py +++ b/langgraph/graph/graph.py @@ -92,6 +92,8 @@ class Branch(NamedTuple): destinations = [self.ends[r] for r in result] else: destinations = result + if any(dest is None for dest in destinations): + raise ValueError("Branch did not return a valid destination") return writer(destinations) or input