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(platform/backend): skip invalid graphs when listing in block menu (#10159)

Toran Bruce Richardse05c34e76a54
diff --git a/autogpt_platform/backend/backend/data/graph.py b/autogpt_platform/backend/backend/data/graph.py
index c556ba0450..7733ec3518 100644
--- a/autogpt_platform/backend/backend/data/graph.py
+++ b/autogpt_platform/backend/backend/data/graph.py
@@ -655,7 +655,10 @@ async def get_graphs(
graph_models = []
for graph in graphs:
try:
- graph_models.append(GraphModel.from_db(graph))
+ graph_model = GraphModel.from_db(graph)
+ # Trigger serialization to validate that the graph is well formed.
+ graph_model.model_dump()
+ graph_models.append(graph_model)
except Exception as e:
logger.error(f"Error processing graph {graph.id}: {e}")
continue