{"record":{"id":"0a1bd35d3789fb21","repo":"flowable/flowable-engine","slug":"could-not-find-a-none-start-event-in-dynamic-sub-p","errorCode":null,"errorMessage":"Could not find a none start event in dynamic sub process for \" + processInstance","messagePattern":"Could not find a none start event in dynamic sub process for \" \\+ processInstance","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/InjectEmbeddedSubProcessInProcessInstanceCmd.java","lineNumber":85,"sourceCode":"        ExecutionEntity subProcessExecution = executionEntityManager.createChildExecution(processInstance);\n        subProcessExecution.setScope(true);\n        subProcessExecution.setCurrentFlowElement(subProcess);\n        CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(subProcessExecution);\n        \n        ExecutionEntity childExecution = executionEntityManager.createChildExecution(subProcessExecution);\n        \n        StartEvent initialEvent = null;\n        for (FlowElement subElement : subProcess.getFlowElements()) {\n            if (subElement instanceof StartEvent startEvent) {\n                if (startEvent.getEventDefinitions().size() == 0) {\n                    initialEvent = startEvent;\n                    break;\n                }\n            }\n        }\n        \n        if (initialEvent == null) {\n            throw new FlowableException(\"Could not find a none start event in dynamic sub process for \" + processInstance);\n        }\n        \n        childExecution.setCurrentFlowElement(initialEvent);\n        \n        Context.getAgenda().planContinueProcessOperation(childExecution);\n    }\n\n}\n","sourceCodeStart":67,"sourceCodeEnd":94,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/InjectEmbeddedSubProcessInProcessInstanceCmd.java#L67-L94","documentation":"During dynamic process instance modification, InjectEmbeddedSubProcessInProcessInstanceCmd.updateExecutions() searches the newly injected sub process BPMN fragment for a none start event to seed the new child execution. If the injected fragment has no such start event, it throws FlowableException. The sub process must be enterable, so a none start event is mandatory.","triggerScenarios":"Calling ProcessInstanceModificationBuilder / dynamic injection APIs (e.g. processInstanceModificationBuilder.injectEmbeddedSubProcess...) with a dynamically built SubProcess fragment whose BpmnModel has only message/timer/signal start events or no start event at all.","commonSituations":"Hand-built or tool-generated dynamic sub process definitions that omit the implicit none start event; copying fragments from templates where the start event was stripped; users assuming Flowable adds a default start event automatically.","solutions":["Add a <startEvent> with no event definitions (a none start event) to the injected sub process fragment.","Validate the dynamically built BpmnModel fragment contains exactly one none start event before injecting.","If the sub process should start on an event, model it explicitly and use the appropriate injection API rather than relying on none-start behavior.","Check the generated process XML/JSON for the missing startEvent element."],"exampleFix":"// before\nSubProcess subProcess = new SubProcess();\nsubProcess.addFlowElement(new UserTask().setId(\"ut1\")); // no start event\n// after\nSubProcess subProcess = new SubProcess();\nsubProcess.addFlowElement(new StartEvent().setId(\"startSub\"));\nsubProcess.addFlowElement(new UserTask().setId(\"ut1\"));\nsubProcess.addFlowElement(new EndEvent().setId(\"endSub\"));","handlingStrategy":"validation","validationCode":"boolean hasNoneStartEvent(SubProcess sp) {\n    return sp.getFlowElements().stream()\n        .anyMatch(fe -> fe instanceof StartEvent se\n            && (se.getEventDefinitions() == null || se.getEventDefinitions().isEmpty()));\n}","typeGuard":null,"tryCatchPattern":"try {\n    modificationBuilder.injectEmbeddedSubProcess(subProcessId);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"none start event\")) {\n        log.error(\"Injected sub process lacks a none start event: fix the BPMN fragment\");\n    }\n    throw e;\n}","preventionTips":["Always include a none StartEvent and EndEvent in dynamically built sub processes","Validate generated BpmnModel fragments before injection","Reuse vetted sub process templates instead of hand-constructed XML"],"tags":["flowable","dynamic-process-modification","bpmn-model","sub-process"],"backgroundTag":"invalid-config-value","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}