{"record":{"id":"1de8d302e7c44ba3","repo":"flowable/flowable-engine","slug":"no-deployed-process-definition-found-with-id-pr","errorCode":null,"errorMessage":"no deployed process definition found with id '${processDefinitionId}'","messagePattern":"no deployed process definition found with id '(.+?)'","errorType":"exception","errorClass":"ActivitiObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/persistence/deploy/DeploymentManager.java","lineNumber":77,"sourceCode":"        for (Deployer deployer : deployers) {\n            deployer.deploy(deployment, deploymentSettings);\n        }\n    }\n\n    public ProcessDefinition findDeployedProcessDefinitionById(String processDefinitionId) {\n        if (processDefinitionId == null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid process definition id : null\");\n        }\n\n        // first try the cache\n        ProcessDefinitionCacheEntry cacheEntry = processDefinitionCache.get(processDefinitionId);\n        ProcessDefinition processDefinition = null;\n        if (cacheEntry == null) {\n            processDefinition = Context.getCommandContext()\n                    .getProcessDefinitionEntityManager()\n                    .findProcessDefinitionById(processDefinitionId);\n            if (processDefinition == null) {\n                throw new ActivitiObjectNotFoundException(\"no deployed process definition found with id '\" + processDefinitionId + \"'\", ProcessDefinition.class);\n            }\n            processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition();\n\n        } else {\n            processDefinition = cacheEntry.getProcessDefinition();\n        }\n        return processDefinition;\n    }\n\n    public ProcessDefinitionEntity findProcessDefinitionByIdFromDatabase(String processDefinitionId) {\n        if (processDefinitionId == null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid process definition id : null\");\n        }\n\n        ProcessDefinitionEntity processDefinition = Context.getCommandContext()\n                .getProcessDefinitionEntityManager()\n                .findProcessDefinitionById(processDefinitionId);\n","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/persistence/deploy/DeploymentManager.java#L59-L95","documentation":"findDeployedProcessDefinitionById resolved neither the definition cache nor the database: the process definition entity with the given id does not exist (or its deployment was deleted), so it throws ActivitiObjectNotFoundException with ProcessDefinition.class. Unlike 4705 the id was non-null — it just doesn't match any deployed definition.","triggerScenarios":"Passing a definition id from another environment/database, an id of a definition whose deployment was deleted (deleteDeployment without cascade leaving references), or a typo'd/truncated id from a REST path parameter.","commonSituations":"Cross-environment data copies (test id used in prod); partial cascade deletes leaving runtime rows pointing at removed definitions; stale cached ids in a client after a redeploy that changed ids.","solutions":["Verify existence: repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult(); if null, the id is wrong or deleted","List actual definitions (processDefinitionKey/latestVersion) and use the correct current id","Check ACT_RE_PROCDEF for the id; if missing but runtime rows reference it, clean those runtime rows or restore the deployment","If deleted unintentionally, redeploy the BPMN (note the id is deployment-scoped; a redeploy yields a new id — update callers)"],"exampleFix":"// before: blindly using a stored id\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();\nif (pd == null) throw new ActivitiObjectNotFoundException(\"no deployed process definition found with id '\" + id + \"'\", ProcessDefinition.class);\n// after: resolve latest by key instead of trusting a stale id\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionKey(key).latestVersion().singleResult();","handlingStrategy":"validation","validationCode":"if (repositoryService.createProcessDefinitionQuery()\n        .processDefinitionId(id).count() == 0) {\n  throw new IllegalStateException(\"no deployed process definition with id \" + id + \" — resolve latest by key instead\");\n}","typeGuard":"Optional<ProcessDefinition> findDefinition(String id) {\n  return Optional.ofNullable(repositoryService.createProcessDefinitionQuery()\n      .processDefinitionId(id).singleResult());\n}","tryCatchPattern":"try {\n  repositoryService.getBpmnModel(defId);\n} catch (FlowableObjectNotFoundException e) {\n  if (e.getObjectClass() != null && ProcessDefinition.class.equals(e.getObjectClass())) {\n    // re-resolve by key/latestVersion or restore the deployment\n  } else { throw e; }\n}","preventionTips":["Use processDefinitionKey+latestVersion queries instead of persisted definition ids for long-lived references","Always delete deployments with cascade=true to keep ACT_RE_PROCDEF and runtime tables consistent","Never copy ids across environments; look up by business key","After redeploys, note ids change — update any stored references"],"tags":["process-definition","not-found","deployment","stale-reference"],"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"}