Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix: guard against missing component IDs in Switch Flow path to prevent NoneType crash (#16279)

OSHA-Ba9eca9de8270
diff --git a/agent/canvas.py b/agent/canvas.py
index fde3e8db82..5d58e24602 100644
--- a/agent/canvas.py
+++ b/agent/canvas.py
@@ -638,9 +638,9 @@ class Canvas(Graph):
break
idx = to
- if any([self.get_component_obj(c).component_name.lower() == "userfillup" for c in self.path[idx:]]):
- path = [c for c in self.path[idx:] if self.get_component(c)["obj"].component_name.lower() == "userfillup"]
- path.extend([c for c in self.path[idx:] if self.get_component(c)["obj"].component_name.lower() != "userfillup"])
+ if any([self.components.get(c) is not None and self.get_component_obj(c).component_name.lower() == "userfillup" for c in self.path[idx:]]):
+ path = [c for c in self.path[idx:] if self.components.get(c) is not None and self.get_component(c)["obj"].component_name.lower() == "userfillup"]
+ path.extend([c for c in self.path[idx:] if self.components.get(c) is not None and self.get_component(c)["obj"].component_name.lower() != "userfillup"])
another_inputs = {}
tips = ""
for c in path: