{"record":{"id":"2b10b2272b763f51","repo":"flowable/flowable-engine","slug":"no-process-definition-found-for-id-processdefini","errorCode":null,"errorMessage":"No process definition found for id '<processDefinitionId>'","messagePattern":"No process definition found for id '<processDefinitionId>'","errorType":"exception","errorClass":"ActivitiObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/StartProcessInstanceByMessageCmd.java","lineNumber":85,"sourceCode":"        MessageEventSubscriptionEntity messageEventSubscription = commandContext.getEventSubscriptionEntityManager()\r\n                .findMessageStartEventSubscriptionByName(messageName, tenantId);\r\n\r\n        if (messageEventSubscription == null) {\r\n            throw new ActivitiObjectNotFoundException(\"Cannot start process instance by message: no subscription to message with name '\" + messageName + \"' found.\", MessageEventSubscriptionEntity.class);\r\n        }\r\n\r\n        String processDefinitionId = messageEventSubscription.getConfiguration();\r\n        if (processDefinitionId == null) {\r\n            throw new ActivitiException(\"Cannot start process instance by message: subscription to message with name '\" + messageName + \"' is not a message start event.\");\r\n        }\r\n\r\n        DeploymentManager deploymentManager = commandContext\r\n                .getProcessEngineConfiguration()\r\n                .getDeploymentManager();\r\n\r\n        ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) deploymentManager.findDeployedProcessDefinitionById(processDefinitionId);\r\n        if (processDefinition == null) {\r\n            throw new ActivitiObjectNotFoundException(\"No process definition found for id '\" + processDefinitionId + \"'\", ProcessDefinition.class);\r\n        }\r\n\r\n        // Do not start process a process instance if the process definition is suspended\r\n        if (deploymentManager.isProcessDefinitionSuspended(processDefinition.getId())) {\r\n            throw new ActivitiException(\"Cannot start process instance. Process definition \"\r\n                    + processDefinition.getName() + \" (id = \" + processDefinition.getId() + \") is suspended\");\r\n        }\r\n\r\n        ActivityImpl startActivity = processDefinition.findActivity(messageEventSubscription.getActivityId());\r\n        ExecutionEntity processInstance = processDefinition.createProcessInstance(businessKey, startActivity);\r\n\r\n        if (processVariables != null) {\r\n            processInstance.setVariables(processVariables);\r\n        }\r\n        if (transientVariables != null) {\r\n            processInstance.setTransientVariables(transientVariables);\r\n        }\r\n\r","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/StartProcessInstanceByMessageCmd.java#L67-L103","documentation":"StartProcessInstanceByMessageCmd throws ActivitiObjectNotFoundException when the process definition ID stored in the message subscription cannot be resolved to a deployed ProcessDefinitionEntity via the DeploymentManager. The subscription exists but its target definition is no longer deployed, so the engine cannot instantiate it and fails with ProcessDefinition.class as the missing type.","triggerScenarios":"Message correlation where the subscription's configuration references a processDefinitionId removed by repositoryService.deleteDeployment(..., cascade=false) or deleted directly from the repository tables.","commonSituations":"Non-cascading deployment cleanup removing definitions while event subscriptions persisted; restoring DB snapshots of event subscriptions without matching definition rows; cache/deployment mismatch after redeploy in a cluster.","solutions":["Redeploy the process definition so the referenced definition ID resolves (or a new subscription is created).","Delete orphaned subscriptions pointing at missing definitions from ACT_RU_EVENT_SUBSCRIPTION.","Use cascade=true when deleting deployments that have active message start subscriptions, and verify subscription validity after cleanup."],"exampleFix":"// before\nrepositoryService.deleteDeployment(deploymentId, false);\nruntimeService.startProcessInstanceByMessage(\"OrderReceived\");\n// after\nrepositoryService.deleteDeployment(deploymentId, true); // cascade removes subscriptions too\nruntimeService.startProcessInstanceByMessage(\"OrderReceived\");","handlingStrategy":"validation","validationCode":"boolean definitionDeployed = repositoryService.createProcessDefinitionQuery()\n        .processDefinitionId(subscription.getConfiguration()).count() > 0;","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.startProcessInstanceByMessage(messageName);\n} catch (ActivitiObjectNotFoundException e) {\n    logger.error(\"Message '{}' points at undeployed definition; redeploying\", messageName, e);\n    repositoryService.createDeployment().addClasspathResource(\"processes/order.bpmn20.xml\").deploy();\n}","preventionTips":["Use cascade=true when deleting deployments with active message subscriptions.","After DB restores, reconcile event subscriptions against definition rows.","Monitor for orphaned subscriptions in ACT_RU_EVENT_SUBSCRIPTION as part of engine health checks."],"tags":["process-definition","not-found","deployment","workflow"],"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"}