From e082ba4f858e0d8daf60263442f881fd3f2cd341 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Tue, 25 Mar 2025 12:50:47 -0700 Subject: [PATCH] Warn when get_graph tries to draw edge that doesn't exist --- libs/langgraph/langgraph/graph/graph.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/langgraph/langgraph/graph/graph.py b/libs/langgraph/langgraph/graph/graph.py index f744d7101..d8bde68ec 100644 --- a/libs/langgraph/langgraph/graph/graph.py +++ b/libs/langgraph/langgraph/graph/graph.py @@ -499,6 +499,11 @@ class CompiledGraph(Pregel): ) -> None: if end == END and END not in end_nodes: end_nodes[END] = graph.add_node(self.get_output_schema(config), END) + if start not in start_nodes or end not in end_nodes: + logger.warning( + f"Could not add edge from '{start}' to '{end}' due to missing nodes" + ) + return return graph.add_edge( start_nodes[start], end_nodes[end],