{"record":{"id":"2801bd1d15390b1a","repo":"flowable/flowable-engine","slug":"provide-start-event-id-is-not-a-start-event-star","errorCode":null,"errorMessage":"Provide start event id is not a start event ${startEventId} for process definition ${id}","messagePattern":"Provide start event id is not a start event (.+?) for process definition (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/ProcessInstanceHelper.java","lineNumber":105,"sourceCode":"        if (ProcessDefinitionUtil.isProcessDefinitionSuspended(processDefinition.getId())) {\n            throw new FlowableException(\"Cannot start process instance. Process definition \" + processDefinition.getName() + \" (id = \" + processDefinition.getId() + \") is suspended\");\n        }\n\n        // Get model from cache\n        Process process = ProcessDefinitionUtil.getProcess(processDefinition.getId());\n        if (process == null) {\n            throw new FlowableException(\"Cannot start process instance. Process model \" + processDefinition.getName() + \" (id = \" + processDefinition.getId() + \") could not be found\");\n        }\n        \n        FlowElement initialFlowElement = null;\n        if (StringUtils.isNotEmpty(startEventId)) {\n            FlowElement startEventFlowElement = process.getFlowElement(startEventId);\n            if (startEventFlowElement == null) {\n                throw new FlowableException(\"No start element found with id \" + startEventId + \" for process definition \" + processDefinition.getId());\n            }\n            \n            if (!(startEventFlowElement instanceof StartEvent)) {\n                throw new FlowableException(\"Provide start event id is not a start event \" + startEventId + \" for process definition \" + processDefinition.getId());\n            }\n            \n            initialFlowElement = startEventFlowElement;\n            \n        } else {\n            initialFlowElement = process.getInitialFlowElement();\n        }\n        \n        if (initialFlowElement == null) {\n            throw new FlowableException(\"No start element found for process definition \" + processDefinition.getId());\n        }\n\n        return createAndStartProcessInstanceWithInitialFlowElement(processDefinition, businessKey, businessStatus, processInstanceName,\n                overrideDefinitionTenantId,\n                predefinedProcessInstanceId, initialFlowElement, process, variables, transientVariables,\n                callbackId, callbackType, referenceId, referenceType, ownerId, assigneeId, stageInstanceId, startProcessInstance);\n    }\n","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/ProcessInstanceHelper.java#L87-L123","documentation":"Process model consistency failure at instance creation: the configured start event id does not resolve to an actual start event of the process definition, so the process instance cannot be started from that entry point.","triggerScenarios":"Calling startProcessInstanceByKey/ById with a startEventId that matches a non-start-event element in the model (task, gateway, end event, etc.).","commonSituations":"Copy/paste of ids between elements; a user task and start event accidentally sharing the same id in hand-edited BPMN; caller targeting the wrong id in a large diagram; generator-produced ids mixed up between diagrams.","solutions":["Use the id of an actual <startEvent> element from the BPMN XML.","Sanity-check the element type: Object el = repositoryService.getBpmnModel(defId).getMainProcess().getFlowElement(id); ensure el instanceof StartEvent.","Fix duplicate ids in the BPMN model and redeploy if a non-start element holds the id you passed.","Omit startEventId to use the default initial start event."],"exampleFix":"// before\nruntimeService.startProcessInstanceById(defId, \"userTask1\", vars); // wrong element\n// after\n// <startEvent id=\"messageStart\" .../>\nruntimeService.startProcessInstanceById(defId, \"messageStart\", vars);","handlingStrategy":"type-guard","validationCode":"FlowElement el = repositoryService.getBpmnModel(defId).getMainProcess().getFlowElement(startEventId);\nif (!(el instanceof org.flowable.bpmn.model.StartEvent)) {\n    throw new IllegalArgumentException(\"startEventId must reference a <startEvent>, got: \" + (el == null ? \"null\" : el.getClass().getSimpleName()));\n}","typeGuard":"public static boolean isStartEventElement(FlowElement el) {\n    return el instanceof org.flowable.bpmn.model.StartEvent;\n}","tryCatchPattern":"try {\n    runtimeService.startProcessInstanceById(defId, null, startEventId, vars);\n} catch (FlowableException e) {\n    if (e.getMessage().startsWith(\"Provide start event id is not a start event\")) {\n        throw new IllegalArgumentException(\"Element '\" + startEventId + \"' is not a start event\", e);\n    }\n    throw e;\n}","preventionTips":["Enforce unique element ids in BPMN models with a linter/ProcessValidator","Never reuse a start event id for a task or gateway","Check the element type before passing ids programmatically"],"tags":["bpmn","start-event","type-mismatch","flowable"],"backgroundTag":"invalid-argument-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"}