{"record":{"id":"f7c15830880e267b","repo":"flowable/flowable-engine","slug":"no-initial-activity-found-for-subprocess-subproc","errorCode":null,"errorMessage":"No initial activity found for subprocess + subProcess.getId() + in + execution","messagePattern":"No initial activity found for subprocess \\+ subProcess\\.getId\\(\\) \\+ in \\+ execution","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SubProcessActivityBehavior.java","lineNumber":56,"sourceCode":" */\npublic class SubProcessActivityBehavior extends AbstractBpmnActivityBehavior {\n\n    private static final long serialVersionUID = 1L;\n  \n    protected boolean isOnlyNoneStartEventAllowed;\n  \n    public SubProcessActivityBehavior() {\n        this.isOnlyNoneStartEventAllowed = true;\n    }\n\n    @Override\n    public void execute(DelegateExecution execution) {\n        SubProcess subProcess = getSubProcessFromExecution(execution);\n\n        FlowElement startElement = getStartElement(subProcess);\n\n        if (startElement == null) {\n            throw new FlowableException(\"No initial activity found for subprocess \" + subProcess.getId() + \" in \" + execution);\n        }\n\n        ExecutionEntity executionEntity = (ExecutionEntity) execution;\n        executionEntity.setScope(true);\n        \n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();\n\n        // initialize the template-defined data objects as variables\n        Map<String, Object> dataObjectVars = processDataObjects(subProcess.getDataObjects());\n        if (dataObjectVars != null) {\n            executionEntity.setVariablesLocal(dataObjectVars);\n        }\n        \n        CommandContext commandContext = Context.getCommandContext();\n        ProcessInstanceHelper processInstanceHelper = processEngineConfiguration.getProcessInstanceHelper();\n        processInstanceHelper.processAvailableEventSubProcesses(executionEntity, subProcess, commandContext);\n\n        ExecutionEntity startSubProcessExecution = CommandContextUtil.getExecutionEntityManager(commandContext).createChildExecution(executionEntity);","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SubProcessActivityBehavior.java#L38-L74","documentation":"SubProcessActivityBehavior.execute looks up the start element that begins the embedded subprocess. If the subprocess model contains no usable initial activity (no start event or none resolvable), the engine cannot enter the subprocess and throws this FlowableException. It almost always means the deployed BPMN model for the subprocess is malformed.","triggerScenarios":"Executing an embedded subprocess whose start element resolves to null: subprocess defined with no start event, or getStartElement returns null because the start event is missing/mis-parented in the model.","commonSituations":"Hand-edited or programmatically generated BPMN XML missing a startEvent inside the subprocess element; modelers deleting the start event of an embedded subprocess; converting an ad-hoc subprocess where a start event was never added.","solutions":["Add a (none) startEvent inside the embedded subprocess in the BPMN XML and redeploy","Re-export/repair the diagram in the Flowable modeler so the subprocess has a valid start event","Check that the process definition deployed is the corrected version (delete old deployment or redeploy)","Validate the BPMN XML against the schema before deployment"],"exampleFix":"// before\n<subProcess id=\"sub1\" name=\"Sub\">\n  <serviceTask id=\"t1\" ... />\n</subProcess>\n// after\n<subProcess id=\"sub1\" name=\"Sub\">\n  <startEvent id=\"sub1Start\" />\n  <sequenceFlow id=\"f1\" sourceRef=\"sub1Start\" targetRef=\"t1\" />\n  <serviceTask id=\"t1\" ... />\n</subProcess>","handlingStrategy":"validation","validationCode":"SubProcess sub = (SubProcess) execution.getCurrentFlowElement();\nboolean ok = sub.getFlowElements().stream()\n    .anyMatch(fe -> fe instanceof StartEvent);\nif (!ok) throw new IllegalStateException(\"Subprocess \" + sub.getId() + \" has no start event\");","typeGuard":"boolean hasStartElement(SubProcess sub) {\n    return sub.getFlowElements().stream().anyMatch(fe -> fe instanceof StartEvent);\n}","tryCatchPattern":null,"preventionTips":["Always model a startEvent inside embedded subprocesses","Validate BPMN XML with the Flowable validator before deployment","Avoid hand-editing generated BPMN XML","Re-deploy after model repairs and confirm the new definition version"],"tags":["bpmn","subprocess","invalid-model","deployment"],"backgroundTag":"resource-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}