{"record":{"id":"9b8afee2f5ce3907","repo":"flowable/flowable-engine","slug":"cannot-start-process-instance-process-model-id","errorCode":null,"errorMessage":"Cannot start process instance. Process model (id = \" + processDefinitionId + \") could not be found for \" + eventSubscription","messagePattern":"Cannot start process instance\\. Process model \\(id = \" \\+ processDefinitionId \\+ \"\\) could not be found for \" \\+ eventSubscription","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/CompensationEventHandler.java","lineNumber":62,"sourceCode":"    public String getEventHandlerType() {\r\n        return CompensateEventSubscriptionEntity.EVENT_TYPE;\r\n    }\r\n\r\n    @Override\r\n    public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) {\r\n\r\n        String configuration = eventSubscription.getConfiguration();\r\n        if (configuration == null) {\r\n            throw new FlowableException(\"Compensating execution not set for \" + eventSubscription);\r\n        }\r\n\r\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\r\n        ExecutionEntity compensatingExecution = processEngineConfiguration.getExecutionEntityManager().findById(configuration);\r\n\r\n        String processDefinitionId = compensatingExecution.getProcessDefinitionId();\r\n        Process process = ProcessDefinitionUtil.getProcess(processDefinitionId);\r\n        if (process == null) {\r\n            throw new FlowableException(\"Cannot start process instance. Process model (id = \" + processDefinitionId + \") could not be found for \" + eventSubscription);\r\n        }\r\n\r\n        FlowElement flowElement = process.getFlowElement(eventSubscription.getActivityId(), true);\r\n\r\n        if (flowElement instanceof SubProcess && !((SubProcess) flowElement).isForCompensation()) {\r\n\r\n            // descend into scope:\r\n            compensatingExecution.setScope(true);\r\n            List<CompensateEventSubscriptionEntity> eventsForThisScope = processEngineConfiguration.getEventSubscriptionServiceConfiguration().getEventSubscriptionService()\r\n                    .findCompensateEventSubscriptionsByExecutionId(compensatingExecution.getId());\r\n            ScopeUtil.throwCompensationEvent(eventsForThisScope, compensatingExecution, false);\r\n\r\n        } else {\r\n\r\n            try {\r\n\r\n                FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();\r\n                if (eventDispatcher != null && eventDispatcher.isEnabled()) {\r","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/event/CompensationEventHandler.java#L44-L80","documentation":"Thrown by CompensationEventHandler.handleEvent when the process model for the compensating execution's processDefinitionId cannot be resolved via ProcessDefinitionUtil.getProcess. Compensation needs the parsed BPMN model to find the compensation handler element; if the model is missing, compensation cannot proceed to start/continue the compensating activity.","triggerScenarios":"handleEvent resolves compensatingExecution and calls ProcessDefinitionUtil.getProcess(processDefinitionId), which returns null - e.g. the process definition was deleted/undeployed while process instances were still running, the definition cache misses the model, or the definition id is stale/invalid.","commonSituations":"Redeploying with cascade deletion of old definitions while runtime instances still reference them; deleting deployments from ACT_RE_* while compensation subscriptions exist in ACT_RU_*; environment where the definition was deployed to a different database; cache/tenant mismatch.","solutions":["Ensure the original process definition and deployment still exist while instances referencing it run - do not cascade-delete deployments with active instances.","Check ACT_RE_PROCDEF for the processDefinitionId in the message; re-deploy the original BPMN XML if it was deleted.","Cancel the stuck process instance (deleteProcessInstance) and start a fresh one on the current definition.","If a tenant/multi-tenant setup is used, verify the definition is deployed under the expected tenant."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionId(processDefinitionId).singleResult();\nif (pd == null) {\n    throw new IllegalStateException(\"definition deleted while instances may still compensate\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    /* trigger compensation */\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"could not be found\")) {\n        // redeploy the original BPMN or cancel the stuck instance\n    }\n}","preventionTips":["Never cascade-delete deployments with active process instances.","Re-deploy the same BPMN resource when re-publishing instead of deleting old versions.","Monitor for event subscriptions referencing missing process definitions.","In multi-tenant setups, verify deployments per tenant."],"tags":["bpmn","compensation","process-definition","resource-not-found"],"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-18T11:17:12.947Z"}