From 04a3fc0ab6449c2ff555bec853b136a1804d0653 Mon Sep 17 00:00:00 2001 From: MrPoll0 Date: Thu, 12 Jun 2025 09:04:58 +0200 Subject: [PATCH] fix: conditional no branch found for evaluation, stop execution --- src/hooks/useFlowExecutor.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/hooks/useFlowExecutor.ts b/src/hooks/useFlowExecutor.ts index 2965661..2a53e0e 100644 --- a/src/hooks/useFlowExecutor.ts +++ b/src/hooks/useFlowExecutor.ts @@ -494,13 +494,11 @@ export function useFlowExecutor(): { state: IExecutorState, actions: IExecutorAc targetNodeId = matchingConnection.target; console.log(`Condition evaluated to ${conditionResult}, following '${targetLabel}' path to node ${targetNodeId}`); } else { - console.warn(`No edge labeled '${targetLabel}' found for condition result ${conditionResult}`); - - // Fallback: take any available edge if one with the right label doesn't exist - if (outgoingConnections.length > 0) { - targetNodeId = outgoingConnections[0].target; - console.log(`Using fallback edge to node ${targetNodeId}`); - } + console.warn(`No edge labeled '${targetLabel}' found for condition result ${conditionResult}. Stopping execution.`); + + // If the required branch is missing, halt execution instead of using a fallback edge + stopExecution(); + return { targetNodeId: null, valuedVariables }; } } else { const connections = reactFlow.getNodeConnections({ nodeId: node.id });