{"record":{"id":"e8e1a35cbd837931","repo":"flowable/flowable-engine","slug":"cannot-find-process-definition-with-id-e8e1a3","errorCode":null,"errorMessage":"Cannot find process definition with id ","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/GetIdentityLinksForProcessDefinitionCmd.java","lineNumber":45,"sourceCode":" */\npublic class GetIdentityLinksForProcessDefinitionCmd implements Command<List<IdentityLink>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String processDefinitionId;\n\n    public GetIdentityLinksForProcessDefinitionCmd(String processDefinitionId) {\n        this.processDefinitionId = processDefinitionId;\n    }\n\n    @Override\n    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n    public List<IdentityLink> 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        List<IdentityLink> identityLinks = (List) processDefinition.getIdentityLinks();\n        return identityLinks;\n    }\n\n}\n","sourceCodeStart":27,"sourceCodeEnd":53,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetIdentityLinksForProcessDefinitionCmd.java#L27-L53","documentation":"GetIdentityLinksForProcessDefinitionCmd loads the process definition by id from the process definition entity manager. When no definition with that id exists it throws ActivitiObjectNotFoundException including the id and ProcessDefinition.class.","triggerScenarios":"Calling RepositoryService.getIdentityLinksForProcessDefinition(id) with an id that is not in ACT_RE_PROCDEF — mistyped id, wrong tenant, definition deleted by cascading deployment delete, or passing a deployment id / key instead of the definition id.","commonSituations":"Confusing process definition key with id; environment mismatch (id from dev used in prod); definitions removed after deployment cleanup; stale cached ids in client code.","solutions":["Resolve the correct id with repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult() and use its getId()","Catch ActivitiObjectNotFoundException and return a friendly 'definition not found' response","Check ACT_RE_PROCDEF (respecting tenant) to confirm the id exists","Verify you are passing the definition id, not the deployment id or key"],"exampleFix":"// before\nrepoService.getIdentityLinksForProcessDefinition(\"myProcess\"); // key, not id\n// after\nProcessDefinition pd = repoService.createProcessDefinitionQuery()\n    .processDefinitionKey(\"myProcess\").latestVersion().singleResult();\nif (pd != null) repoService.getIdentityLinksForProcessDefinition(pd.getId());","handlingStrategy":"try-catch","validationCode":"boolean exists = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionId(processDefinitionId).count() > 0;","typeGuard":"boolean definitionExists(String id) {\n    return id != null && repositoryService.createProcessDefinitionQuery().processDefinitionId(id).count() > 0;\n}","tryCatchPattern":"try {\n    repositoryService.getIdentityLinksForProcessDefinition(id);\n} catch (ActivitiObjectNotFoundException e) {\n    // map to 404 with the definition id\n}","preventionTips":["Distinguish key vs id vs deploymentId when storing references","Include tenantId in queries for multi-tenant setups","Refresh stored ids after redeployments (new versions get new ids)"],"tags":["flowable","activiti","not-found","process-definition","identity-links"],"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"}