diff --git a/core/src/main/java/io/kestra/core/runners/ExecutableUtils.java b/core/src/main/java/io/kestra/core/runners/ExecutableUtils.java index 336c0c785c3..5bc9ee127ba 100644 --- a/core/src/main/java/io/kestra/core/runners/ExecutableUtils.java +++ b/core/src/main/java/io/kestra/core/runners/ExecutableUtils.java @@ -65,28 +65,11 @@ public static > SubflowExecution subflowEx boolean inheritLabels, Property scheduleDate ) throws IllegalVariableEvaluationException { + String tenantId = currentExecution.getTenantId(); String subflowNamespace = runContext.render(currentTask.subflowId().namespace()); String subflowId = runContext.render(currentTask.subflowId().flowId()); Optional subflowRevision = currentTask.subflowId().revision(); - - io.kestra.core.models.flows.Flow flow = flowExecutorInterface.findByIdFromTask( - currentExecution.getTenantId(), - subflowNamespace, - subflowId, - subflowRevision, - currentExecution.getTenantId(), - currentFlow.getNamespace(), - currentFlow.getId() - ) - .orElseThrow(() -> new IllegalStateException("Unable to find flow '" + subflowNamespace + "'.'" + subflowId + "' with revision '" + subflowRevision.orElse(0) + "'")); - - if (flow.isDisabled()) { - throw new IllegalStateException("Cannot execute a flow which is disabled"); - } - - if (flow instanceof FlowWithException fwe) { - throw new IllegalStateException("Cannot execute an invalid flow: " + fwe.getException()); - } + Flow flow = getSubflow(tenantId, subflowNamespace, subflowId, subflowRevision, flowExecutorInterface, currentFlow); List