{"record":{"id":"49f28741b9afca5d","repo":"flowable/flowable-engine","slug":"could-not-find-a-case-definition-with-id-casede-49f287","errorCode":null,"errorMessage":"Could not find a case definition with id '${caseDefinitionId}'.","messagePattern":"Could not find a case definition with id '(.+?)'\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/CaseDefinitionResourceDataResource.java","lineNumber":56,"sourceCode":"    @ApiOperation(value = \"Get a case definition resource content\", tags = { \"Case Definitions\" })\n    @ApiResponses(value = {\n            @ApiResponse(code = 200, message = \"Indicates both case definition and resource have been found and the resource data has been returned.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested case definition was not found or there is no resource with the given id present in the case definition. The status-description contains additional information.\")\n    })\n    @GetMapping(value = \"/cmmn-repository/case-definitions/{caseDefinitionId}/resourcedata\")\n    public byte[] getProcessDefinitionResource(@ApiParam(name = \"caseDefinitionId\") @PathVariable String caseDefinitionId, HttpServletResponse response) {\n        CaseDefinition caseDefinition = getCaseDefinitionFromRequest(caseDefinitionId);\n        return getDeploymentResourceData(caseDefinition.getDeploymentId(), caseDefinition.getResourceName(), response);\n    }\n\n    /**\n     * Returns the {@link CaseDefinition} that is requested. Throws the right exceptions when bad request was made or definition was not found.\n     */\n    protected CaseDefinition getCaseDefinitionFromRequest(String caseDefinitionId) {\n        CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().caseDefinitionId(caseDefinitionId).singleResult();\n\n        if (caseDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a case definition with id '\" + caseDefinitionId + \"'.\", CaseDefinition.class);\n        }\n        return caseDefinition;\n    }\n}\n","sourceCodeStart":38,"sourceCodeEnd":61,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/CaseDefinitionResourceDataResource.java#L38-L61","documentation":"getCaseDefinitionFromRequest queries the repository by exact case definition id and throws FlowableObjectNotFoundException with CaseDefinition.class when singleResult() returns null. This is the canonical 'unknown caseDefinitionId' 404 used across case-definition REST endpoints.","triggerScenarios":"Any endpoint that resolves a case definition (data, image, model, identitylinks, actions) with an id that does not exist — typo, deleted deployment, wrong engine/tenant, or an id from a different definition type (e.g., a process definition id).","commonSituations":"Hardcoded ids after redeployments (new id per version); cross-tenant lookups without fallback-to-default-tenant enabled; querying the CMMN engine with a BPMN id; environments cleaned between tests.","solutions":["Verify the id by listing GET /cmmn-repository/case-definitions and copying the exact id.","Remember case definitions get a new id per deployed version; use the latest key/version or latest=true query if appropriate.","Confirm you target the right engine and tenant (enable fallback to default tenant if needed).","Do not pass process definition ids to CMMN endpoints."],"exampleFix":"// before\nGET /cmmn-repository/case-definitions/myCase:1:4  // stale id after redeploy\n// after\nGET /cmmn-repository/case-definitions?key=myCase&latest=true","handlingStrategy":"try-catch","validationCode":"CaseDefinition cd = repositoryService.createCaseDefinitionQuery().caseDefinitionId(id).singleResult(); if (cd == null) { /* resolve by key/latest first */ }","typeGuard":null,"tryCatchPattern":"try { ... } catch (FlowableObjectNotFoundException e) { refresh id via GET /cmmn-repository/case-definitions?key=...&latest=true; retry once; }","preventionTips":["Never hardcode definition ids across redeploys — resolve by key + latest.","Verify tenant/engine routing before querying.","Confirm the id is a CMMN case definition id, not a BPMN one.","Refresh ids after deployments in test environments."],"tags":["rest-api","not-found","case-definition"],"backgroundTag":"record-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"}