From d4b3364bba12f19c0826aff7cb24b466dc88486c Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Mon, 20 May 2024 12:00:10 -0700 Subject: [PATCH] Raise error if cond edge returns None --- langgraph/graph/graph.py | 2 ++ 1 file changed, 2 insertions(+) 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