{"record":{"id":"c0d2402139acd17f","repo":"flowable/flowable-engine","slug":"cannot-find-process-definition-with-id-c0d240","errorCode":null,"errorMessage":"Cannot find process definition with id ","messagePattern":"Cannot find process definition with id ","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetIdentityLinksForProcessDefinitionCmd.java","lineNumber":44,"sourceCode":"/**\n * @author Tijs Rademakers\n */\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    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n    @Override\n    public List<IdentityLink> execute(CommandContext commandContext) {\n        ProcessDefinitionEntity processDefinition = CommandContextUtil.getProcessDefinitionEntityManager(commandContext).findById(processDefinitionId);\n\n        if (processDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"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":26,"sourceCodeEnd":52,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetIdentityLinksForProcessDefinitionCmd.java#L26-L52","documentation":"GetIdentityLinksForProcessDefinitionCmd.execute looks up the process definition via ProcessDefinitionEntityManager.findById and throws FlowableObjectNotFoundException when no definition matches processDefinitionId. Identity links for a definition (potential starters) hang off that entity, so a missing definition makes the operation impossible. This guards callers from an NPE on processDefinition.getIdentityLinks().","triggerScenarios":"Calling RepositoryService.getIdentityLinksForProcessDefinition(definitionId) with an id that is not in ACT_RE_PROCDEF — typo, id from another deployment/database, or the definition was deleted via cascade delete of a deployment.","commonSituations":"Hardcoding a definition id that changed after redeployment; passing a model id instead of a process definition id; multi-tenant setup where the definition exists only in another tenant; environment drift between dev and prod databases.","solutions":["Confirm the id via repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult()","Resolve the id by key instead: repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult()","Check tenant: add .processDefinitionTenantId(...) to your query to search the right tenant","Verify the deployment containing the definition still exists (deployment was not cascade-deleted)","Catch FlowableObjectNotFoundException and return an empty list or a clear user-facing message"],"exampleFix":"// before\nList<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(defId);\n// after\nProcessDefinition def = repositoryService.createProcessDefinitionQuery().processDefinitionId(defId).singleResult();\nList<IdentityLink> links = (def != null)\n    ? repositoryService.getIdentityLinksForProcessDefinition(defId)\n    : Collections.emptyList();","handlingStrategy":"validation","validationCode":"ProcessDefinition def = repositoryService.createProcessDefinitionQuery().processDefinitionId(defId).singleResult();\nif (def == null) throw new IllegalArgumentException(\"Unknown process definition: \" + defId);","typeGuard":null,"tryCatchPattern":"try {\n  List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(defId);\n} catch (FlowableObjectNotFoundException e) {\n  links = Collections.emptyList();\n}","preventionTips":["Never hardcode definition ids; resolve from the key + latestVersion at runtime","Confirm tenant context when running multi-tenant","Check that deployments holding the definition were not cascade-deleted","Validate ids from external input against a definition query first"],"tags":["flowable","process-definition","not-found","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"}