{"record":{"id":"c6d7e97c02e85279","repo":"flowable/flowable-engine","slug":"cannot-find-process-definition-with-id-c6d7e9","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/GetPotentialStarterGroupsCmd.java","lineNumber":48,"sourceCode":" * @author Tijs Rademakers\n */\npublic class GetPotentialStarterGroupsCmd implements Command<List<Group>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    protected String processDefinitionId;\n\n    public GetPotentialStarterGroupsCmd(String processDefinitionId) {\n        this.processDefinitionId = processDefinitionId;\n    }\n\n    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n    @Override\n    public List<Group> 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        IdentityService identityService = CommandContextUtil.getProcessEngineConfiguration(commandContext).getIdentityService();\n\n        List<String> groupIds = new ArrayList<>();\n        List<IdentityLink> identityLinks = (List) processDefinition.getIdentityLinks();\n        for (IdentityLink identityLink : identityLinks) {\n            if (identityLink.getGroupId() != null && identityLink.getGroupId().length() > 0) {\n\n                if (!groupIds.contains(identityLink.getGroupId())) {\n                    groupIds.add(identityLink.getGroupId());\n                }\n            }\n        }\n\n        if (groupIds.size() > 0) {\n            return identityService.createGroupQuery().groupIds(groupIds).list();\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetPotentialStarterGroupsCmd.java#L30-L66","documentation":"GetPotentialStarterGroupsCmd.execute loads the ProcessDefinitionEntity by id and throws FlowableObjectNotFoundException when not found. Potential starter groups are derived from the definition's identity links, so the definition must exist. Throwing avoids NPE on processDefinition.getIdentityLinks().","triggerScenarios":"Calling RepositoryService.getIdentityLinksForProcessDefinition-style potential-starter API, e.g. repositoryService.getIdentityLinksForProcessDefinition(defId) routed to this command, with a defId absent from ACT_RE_PROCDEF (typo, deleted deployment, wrong tenant/db).","commonSituations":"Definition id captured before a redeploy replaced ids; passing process key instead of id; multi-tenant apps querying without the correct tenant; environment mismatch between dev and prod.","solutions":["Validate the definition exists: repositoryService.createProcessDefinitionQuery().processDefinitionId(defId).singleResult()","Look up the id from the key: .processDefinitionKey(key).latestVersion().singleResult() then use its getId()","Include the tenant in the query if running multi-tenant (.processDefinitionTenantId) or use TenantContext","Confirm the deployment was not cascade-deleted (check ACT_RE_DEPLOYMENT)","Catch FlowableObjectNotFoundException and return empty starter groups with a warning"],"exampleFix":"// before\nList<Group> groups = repositoryService.getIdentityLinksForProcessDefinition(defId); // wrong id type\n// after\nProcessDefinition def = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionKey(\"orderProcess\").latestVersion().singleResult();\nList<Group> groups = repositoryService.getIdentityLinksForProcessDefinition(def.getId());","handlingStrategy":"validation","validationCode":"ProcessDefinition def = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionId(defId).singleResult();\nif (def == null) {\n  def = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionLatestVersion().processDefinitionTenantId(tenant)\n    .processDefinitionKey(key).singleResult();\n}","typeGuard":null,"tryCatchPattern":"try {\n  List<Group> groups = repositoryService.getIdentityLinksForProcessDefinition(defId);\n} catch (FlowableObjectNotFoundException e) {\n  groups = Collections.emptyList();\n}","preventionTips":["Resolve definition ids from keys and latestVersion rather than storing ids","Always set tenant context in multi-tenant deployments","Verify the deployment still exists after cleanup jobs","Gate starter-group lookups behind an existence query"],"tags":["flowable","process-definition","not-found","start-authorization"],"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-18T11:17:12.947Z"}