From 60f6cf3c6d8f41d3e86e99744ebb8845562429b2 Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 13 Apr 2026 08:16:06 +0200 Subject: [PATCH] fix: Add null check for logic node expression to prevent AttributeError Problem: Logic nodes without logic_expression defined caused AttributeError "'NoneType' object has no attribute 'operator'" when evaluating condition. Solution: Check both node.condition AND node.condition.expression before calling evaluate_logic_expression(). Return clear FAILED state with error message instead of crashing. Impact: Workflows with incomplete logic node definitions now fail gracefully with clear error message instead of cryptic AttributeError. --- backend/workflow_executor.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/workflow_executor.py b/backend/workflow_executor.py index e5a7152..693c7ed 100644 --- a/backend/workflow_executor.py +++ b/backend/workflow_executor.py @@ -398,8 +398,16 @@ def execute_logic_node( started_at = datetime.utcnow().isoformat() try: - if not node.condition: - raise ValueError(f"Logic node {node.id} has no condition") + if not node.condition or not node.condition.expression: + error_msg = f"Logic node {node.id} has no condition/expression defined" + logger.error(error_msg) + return NodeExecutionState( + node_id=node.id, + status=NodeStatus.FAILED, + error=error_msg, + started_at=started_at, + completed_at=datetime.utcnow().isoformat() + ) # 1. Evaluiere Bedingung result, error = evaluate_logic_expression(node.condition.expression, context)