{"record":{"id":"ac3a7eadf7f0a891","repo":"flowable/flowable-engine","slug":"cannot-find-process-definition-with-id-processde-ac3a7e","errorCode":null,"errorMessage":"Cannot find process definition with id ${processDefinitionId}","messagePattern":"Cannot find process definition with id (.+?)","errorType":"exception","errorClass":"ActivitiObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/DeleteIdentityLinkForProcessDefinitionCmd.java","lineNumber":62,"sourceCode":"\n    protected void validateParams(String userId, String groupId, String processDefinitionId) {\n        if (processDefinitionId == null) {\n            throw new ActivitiIllegalArgumentException(\"processDefinitionId is null\");\n        }\n\n        if (userId == null && groupId == null) {\n            throw new ActivitiIllegalArgumentException(\"userId and groupId cannot both be null\");\n        }\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        ProcessDefinitionEntity processDefinition = commandContext\n                .getProcessDefinitionEntityManager()\n                .findProcessDefinitionById(processDefinitionId);\n\n        if (processDefinition == null) {\n            throw new ActivitiObjectNotFoundException(\"Cannot find process definition with id \" + processDefinitionId, ProcessDefinition.class);\n        }\n\n        processDefinition.deleteIdentityLink(userId, groupId);\n\n        return null;\n    }\n\n}\n","sourceCodeStart":44,"sourceCodeEnd":71,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/DeleteIdentityLinkForProcessDefinitionCmd.java#L44-L71","documentation":"After passing validation, the command loads the process definition via the ProcessDefinitionEntityManager. If no definition exists with the given id (it was deleted, never deployed in this database, or the id is malformed), it throws ActivitiObjectNotFoundException referencing ProcessDefinition.class.","triggerScenarios":"Calling deleteProcessDefinitionIdentityLink/deleteCandidateStarterUser/Group with a processDefinitionId that does not exist in ACT_RE_PROCDEF — wrong database, deleted deployment, stale id after redeployment, or id of a different entity type.","commonSituations":"Multi-environment setups where ids from test are replayed against production; cascade job that deleted the deployment earlier in the same transaction; ids serialized and reused after redeploying a new version.","solutions":["Verify existence first: repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult(); skip if null.","Confirm you are connected to the repository database where the definition was deployed.","Re-resolve the id from the definition key + version instead of caching ids across deployments.","Catch ActivitiObjectNotFoundException and treat the link removal as a no-op if the definition is gone."],"exampleFix":"// before\nrepositoryService.deleteCandidateStarterGroup(processDefinitionId, \"sales\");\n// after\nif (repositoryService.createProcessDefinitionQuery()\n        .processDefinitionId(processDefinitionId).count() > 0) {\n    repositoryService.deleteCandidateStarterGroup(processDefinitionId, \"sales\");\n}","handlingStrategy":"try-catch","validationCode":"if (repositoryService.createProcessDefinitionQuery()\n        .processDefinitionId(processDefinitionId).count() == 0) {\n    return; // definition not present in this database\n}","typeGuard":null,"tryCatchPattern":"try {\n    repositoryService.deleteProcessDefinitionIdentityLink(defId, userId, groupId);\n} catch (ActivitiObjectNotFoundException e) {\n    log.warn(\"Process definition {} not found; skipping identity link removal\", defId);\n}","preventionTips":["Never cache process definition ids across environments or redeployments","Re-resolve ids from key + latestVersion at cleanup time","Check deployment deletions earlier in the same pipeline before removing identity links"],"tags":["process-definition","not-found","repository","identity-link"],"backgroundTag":"entity-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"}