Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(backend): Error out execution when no starting node is available (#9566)

Zamil Majdy3adc9724fefd
diff --git a/autogpt_platform/backend/backend/data/graph.py b/autogpt_platform/backend/backend/data/graph.py
index 39fdd5b6ed..1857c5fd51 100644
--- a/autogpt_platform/backend/backend/data/graph.py
+++ b/autogpt_platform/backend/backend/data/graph.py
@@ -365,10 +365,12 @@ class GraphModel(Graph):
)
and (
for_run # Skip input completion validation, unless when executing.
- or block.block_type == BlockType.INPUT
- or block.block_type == BlockType.OUTPUT
- or block.block_type == BlockType.AGENT
- or block.block_type == BlockType.AI
+ or block.block_type
+ in [
+ BlockType.INPUT,
+ BlockType.OUTPUT,
+ BlockType.AGENT,
+ ]
)
):
raise ValueError(
diff --git a/autogpt_platform/backend/backend/executor/manager.py b/autogpt_platform/backend/backend/executor/manager.py
index 2a3100166f..79225f9b34 100644
--- a/autogpt_platform/backend/backend/executor/manager.py
+++ b/autogpt_platform/backend/backend/executor/manager.py
@@ -938,6 +938,11 @@ class ExecutionManager(AppService):
else:
nodes_input.append((node.id, input_data))
+ if not nodes_input:
+ raise ValueError(
+ "No starting nodes found for the graph, make sure an AgentInput or blocks with no inbound links are present as starting nodes."
+ )
+
graph_exec_id, node_execs = self.db_client.create_graph_execution(
graph_id=graph_id,
graph_version=graph.version,