{"record":{"id":"f8758c5857301f7e","repo":"flowable/flowable-engine","slug":"cannot-find-process-definition-with-id-processde-f8758c","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/AddIdentityLinkForProcessDefinitionCmd.java","lineNumber":61,"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.addIdentityLink(userId, groupId);\n\n        return null;\n    }\n\n}\n","sourceCodeStart":43,"sourceCodeEnd":70,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/AddIdentityLinkForProcessDefinitionCmd.java#L43-L70","documentation":"During execute, AddIdentityLinkForProcessDefinitionCmd looks up the process definition via ProcessDefinitionEntityManager.findProcessDefinitionById. If no definition exists for the given id, Flowable throws ActivitiObjectNotFoundException so the caller knows the target entity does not exist rather than silently doing nothing.","triggerScenarios":"Calling addUserIdentityLinkForProcessDefinition with an id that was never deployed, already deleted, or that is actually a definition key instead of an id.","commonSituations":"Copying a definition id from another environment (test vs prod database); stale cached id after redeployment; passing the process definition key (e.g. 'myProcess') instead of the id (e.g. 'myProcess:1:4').","solutions":["Verify the id with repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult() before linking","If you only have the key, resolve the latest definition id first","Confirm you are connected to the database/environment where the definition was deployed"],"exampleFix":"// before\nrepositoryService.addUserIdentityLinkForProcessDefinition(\"myProcess\", userId); // key, not id\n// after\nProcessDefinition def = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionKey(\"myProcess\").latestVersion().singleResult();\nrepositoryService.addUserIdentityLinkForProcessDefinition(def.getId(), userId);","handlingStrategy":"validation","validationCode":"ProcessDefinition def = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionId(defId).singleResult();\nif (def == null) {\n    throw new IllegalStateException(\"No process definition for id \" + defId);\n}","typeGuard":null,"tryCatchPattern":"try {\n    repositoryService.addUserIdentityLinkForProcessDefinition(defId, userId);\n} catch (ActivitiObjectNotFoundException e) {\n    if (ProcessDefinition.class.equals(e.getObjectClass())) {\n        // resolve latest definition by key and retry\n    } else { throw e; }\n}","preventionTips":["Look up ids with ProcessDefinitionQuery instead of trusting external input","Convert definition keys to ids of the latest version before use","Verify environment/datasource consistency when reusing ids across systems"],"tags":["not-found","process-definition","identity-link","lookup"],"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"}