{"record":{"id":"6c978faacc676134","repo":"kestra-io/kestra","slug":"cannot-execute-an-invalid-flow","errorCode":null,"errorMessage":"Cannot execute an invalid flow: {}","messagePattern":"Cannot execute an invalid flow: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/ExecutableUtils.java","lineNumber":201,"sourceCode":"                    currentFlow.getId()\n                )\n                    .orElseThrow(() ->\n                    {\n                        String msg = \"Unable to find flow '\" + subflowNamespace + \"'.'\" + subflowId + \"' with revision '\" + subflowRevision.orElse(0) + \"'\";\n                        runContext.logger().error(msg);\n                        return new IllegalStateException(msg);\n                    });\n\n                if (flow.isDisabled()) {\n                    String msg = \"Cannot execute a flow which is disabled\";\n                    runContext.logger().error(msg);\n                    throw new IllegalStateException(msg);\n                }\n\n                if (flow instanceof FlowWithException fwe) {\n                    String msg = \"Cannot execute an invalid flow: \" + fwe.getException();\n                    runContext.logger().error(msg);\n                    throw new IllegalStateException(msg);\n                }\n\n                List<Label> newLabels = inheritLabels ? new ArrayList<>(filterLabels(currentExecution.getLabels(), flow)) : new ArrayList<>(systemLabels(currentExecution));\n                if (labels != null) {\n                    labels.forEach(throwConsumer(label -> newLabels.add(new Label(runContext.render(label.key()), runContext.render(label.value())))));\n                }\n\n                var variables = ImmutableMap.<String, Object> builder().putAll(\n                    Map.of(\n                        \"executionId\", currentExecution.getId(),\n                        \"namespace\", currentFlow.getNamespace(),\n                        \"flowId\", currentFlow.getId(),\n                        \"flowRevision\", currentFlow.getRevision(),\n                        \"taskRunId\", currentTaskRun.getId(),\n                        \"taskId\", currentTaskRun.getTaskId()\n                    )\n                );\n                if (currentTaskRun.getValue() != null) {","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/ExecutableUtils.java#L183-L219","documentation":"Error \"Cannot execute an invalid flow: {}\" thrown in kestra-io/kestra.","triggerScenarios":"Thrown at core/src/main/java/io/kestra/core/runners/ExecutableUtils.java:201 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the validation errors reported on the flow (shown in the message or via flow validation), then execute it again.","Run 'kestra flow validate' or check the UI validation panel to list the flow's violations."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}