{"record":{"id":"1bb2e06f76336294","repo":"flowable/flowable-engine","slug":"cannot-find-case-definition-with-id-1bb2e0","errorCode":null,"errorMessage":"Cannot find case definition with id ","messagePattern":"Cannot find case definition with id ","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetIdentityLinksForCaseDefinitionCmd.java","lineNumber":47,"sourceCode":" */\npublic class GetIdentityLinksForCaseDefinitionCmd implements Command<List<IdentityLink>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    \n    protected String caseDefinitionId;\n\n    public GetIdentityLinksForCaseDefinitionCmd(String caseDefinitionId) {\n        this.caseDefinitionId = caseDefinitionId;\n    }\n\n    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n    @Override\n    public List<IdentityLink> execute(CommandContext commandContext) {\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        CaseDefinitionEntity caseDefinition = cmmnEngineConfiguration.getCaseDefinitionEntityManager().findById(caseDefinitionId);\n\n        if (caseDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find case definition with id \" + caseDefinitionId, CaseDefinition.class);\n        }\n\n        List<IdentityLink> identityLinks = (List) caseDefinition.getIdentityLinks();\n        return identityLinks;\n    }\n\n}\n","sourceCodeStart":29,"sourceCodeEnd":55,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetIdentityLinksForCaseDefinitionCmd.java#L29-L55","documentation":"Thrown by GetIdentityLinksForCaseDefinitionCmd when the CMMN engine cannot load a CaseDefinition with the supplied id. The command looks up the case definition via the CaseDefinitionEntityManager and throws FlowableObjectNotFoundException when findById returns null. This is a caller-supplied identifier problem: the referenced case definition does not exist in the engine's repository.","triggerScenarios":"Calling RuntimeService/TaskService identity-link APIs (e.g. CmmnRuntimeService.getIdentityLinksForCaseDefinition) with an id that was never deployed, was deployed to a different database/tenant, or was deleted by an earlier undeploy/cascade delete.","commonSituations":"Hard-coded case definition ids in tests or scripts; querying identity links after a redeploy changed the definition id; pointing a client at the wrong database or schema so the definition is absent; stale ids cached in an external system after cleanup.","solutions":["Verify the id exists: run a CaseDefinitionQuery (repositoryService.createCaseDefinitionQuery().caseDefinitionId(id).singleResult()) or list all definitions and use a valid id.","Use the latest deployed version: look up by key with .latestVersion() and take its id instead of a stored one.","Check you are connected to the same database/schema/environment where the definition was deployed.","If the definition was deleted, redeploy the CMMN model and retry with the new id."],"exampleFix":"// before\nList<IdentityLink> links = cmmnRuntimeService.getIdentityLinksForCaseDefinition(\"myCaseDef-1\");\n// after\nCaseDefinition def = cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionKey(\"myCaseDef\").latestVersion().singleResult();\nList<IdentityLink> links = cmmnRuntimeService.getIdentityLinksForCaseDefinition(def.getId());","handlingStrategy":"validation","validationCode":"CaseDefinition def = cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionId(caseDefId).singleResult();\nif (def == null) throw new IllegalArgumentException(\"Unknown case definition id: \" + caseDefId);","typeGuard":"boolean caseDefinitionExists(String id) {\n    return cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionId(id).count() > 0;\n}","tryCatchPattern":"try {\n    links = cmmnRuntimeService.getIdentityLinksForCaseDefinition(caseDefId);\n} catch (FlowableObjectNotFoundException e) {\n    log.warn(\"Case definition {} not found\", caseDefId);\n    links = Collections.emptyList();\n}","preventionTips":["Resolve definition ids by key + latestVersion instead of storing raw ids","Verify ids after every redeploy/undeploy","Confirm environment/database before querying","Treat definition ids as unstable across deployments"],"tags":["flowable","cmmn","not-found","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"}