{"record":{"id":"bf099e628ba683d8","repo":"flowable/flowable-engine","slug":"cannot-find-case-definition-for-id","errorCode":null,"errorMessage":"Cannot find case definition for id: ","messagePattern":"Cannot find case definition for id: ","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetDecisionsForCaseDefinitionCmd.java","lineNumber":55,"sourceCode":"/**\n * @author Tijs Rademakers\n */\npublic class GetDecisionsForCaseDefinitionCmd implements Command<List<DmnDecision>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String caseDefinitionId;\n    protected DmnRepositoryService dmnRepositoryService;\n\n    public GetDecisionsForCaseDefinitionCmd(String caseDefinitionId) {\n        this.caseDefinitionId = caseDefinitionId;\n    }\n\n    @Override\n    public List<DmnDecision> execute(CommandContext commandContext) {\n        CaseDefinition caseDefinition = CaseDefinitionUtil.getCaseDefinition(caseDefinitionId);\n        \n        if (caseDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find case definition for id: \" + caseDefinitionId, CaseDefinition.class);\n        }\n        \n        Case caseModel = CaseDefinitionUtil.getCase(caseDefinitionId);\n\n        if (caseModel == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find case definition for id: \" + caseDefinitionId, Case.class);\n        }\n\n        dmnRepositoryService = CommandContextUtil.getDmnEngineConfiguration(commandContext).getDmnRepositoryService();\n        if (dmnRepositoryService == null) {\n            throw new FlowableException(\"DMN repository service is not available\");\n        }\n\n        List<DmnDecision> decision = getDecisionsFromModel(caseModel, caseDefinition);\n\n        return decision;\n    }\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetDecisionsForCaseDefinitionCmd.java#L37-L73","documentation":"GetDecisionsForCaseDefinitionCmd first resolves the CaseDefinition via CaseDefinitionUtil.getCaseDefinition. If no case definition matches the supplied caseDefinitionId, it throws FlowableObjectNotFoundException typed to CaseDefinition. This surfaces a wrong or unknown case definition id rather than a missing decision table.","triggerScenarios":"Calling getDecisionsForCaseDefinition(caseDefinitionId) with an id not present in ACT_RE_CASEDEF — wrong id, id from another engine/database, or a case definition that was deleted.","commonSituations":"Hard-coded definition ids that break after redeployment (ids are version-specific); environment mismatch (test id used in prod); DB not populated because deployments never ran.","solutions":["Look up the current case definition id via RepositoryService.createCaseDefinitionQuery().latestVersion() and use its id","Verify the CMMN deployment actually exists in the connected database","Correct the caseDefinitionId (check for typos or stale/version-specific ids)","Re-deploy the CMMN model if it is missing from the target environment"],"exampleFix":"// before\nList<DmnDecision> decisions = cmmnEngineConfiguration.getCommandExecutor()\n    .execute(new GetDecisionsForCaseDefinitionCmd(\"myCaseDef\"));\n// after\nCaseDefinition cd = repositoryService.createCaseDefinitionQuery()\n    .caseDefinitionKey(\"myCaseDef\").latestVersion().singleResult();\nif (cd != null) {\n    List<DmnDecision> decisions = ... new GetDecisionsForCaseDefinitionCmd(cd.getId());\n}","handlingStrategy":"validation","validationCode":"CaseDefinition cd = repositoryService.createCaseDefinitionQuery().caseDefinitionId(id).singleResult(); // null check before use","typeGuard":null,"tryCatchPattern":"try { return getDecisionsForCaseDefinition(id); } catch (FlowableObjectNotFoundException e) { log.warn(\"No case definition {}: {}\", id, e.getMessage()); return Collections.emptyList(); }","preventionTips":["Never hard-code version-specific definition ids","Resolve latest definition by key at runtime","Ensure deployments ran in every target environment"],"tags":["java","flowable","not-found","case-definition","dmn"],"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-14T05:17:10.506Z"}