From 8a20c6f7e4c89117ea1abef9b60e0ad8463eb189 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Wed, 24 Jul 2024 09:29:38 -0700 Subject: [PATCH] Avoid crash when a node in pending sends is removed --- libs/langgraph/langgraph/pregel/algo.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/langgraph/langgraph/pregel/algo.py b/libs/langgraph/langgraph/pregel/algo.py index 13ce7e183..d94d4e166 100644 --- a/libs/langgraph/langgraph/pregel/algo.py +++ b/libs/langgraph/langgraph/pregel/algo.py @@ -257,6 +257,9 @@ def prepare_next_tasks( if not isinstance(packet, Send): logger.warn(f"Ignoring invalid packet type {type(packet)} in pending sends") continue + if packet.node not in processes: + logger.warn(f"Ignoring unknown node name {packet.node} in pending sends") + continue if for_execution: proc = processes[packet.node] if node := proc.get_node():