flowable/flowable-engine · error · FlowableObjectNotFoundException
Could not find a case definition with id
Error message
Could not find a case definition with id '${caseDefinitionId}'. What it means
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.
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.
Example fix
// before GET /cmmn-repository/case-definitions/myCase:1:4 // stale id after redeploy // after GET /cmmn-repository/case-definitions?key=myCase&latest=true
Defensive patterns
Strategy: try-catch
Validate before calling
CaseDefinition cd = repositoryService.createCaseDefinitionQuery().caseDefinitionId(id).singleResult(); if (cd == null) { /* resolve by key/latest first */ } Try / catch
try { ... } catch (FlowableObjectNotFoundException e) { refresh id via GET /cmmn-repository/case-definitions?key=...&latest=true; retry once; } Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Could not find a case definition with id
- ${aonfe.getMessage()}
- Batch part with id ' ' does not have a batch part document.
- Batch with id ' ' does not have a batch document.
- Cannot find case definition for id:
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/49f28741b9afca5d.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/CaseDefinitionResourceDataResource.java:56
@ApiOperation(value = "Get a case definition resource content", tags = { "Case Definitions" })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Indicates both case definition and resource have been found and the resource data has been returned."),
@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.")
})
@GetMapping(value = "/cmmn-repository/case-definitions/{caseDefinitionId}/resourcedata")
public byte[] getProcessDefinitionResource(@ApiParam(name = "caseDefinitionId") @PathVariable String caseDefinitionId, HttpServletResponse response) {
CaseDefinition caseDefinition = getCaseDefinitionFromRequest(caseDefinitionId);
return getDeploymentResourceData(caseDefinition.getDeploymentId(), caseDefinition.getResourceName(), response);
}
/**
* Returns the {@link CaseDefinition} that is requested. Throws the right exceptions when bad request was made or definition was not found.
*/
protected CaseDefinition getCaseDefinitionFromRequest(String caseDefinitionId) {
CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().caseDefinitionId(caseDefinitionId).singleResult();
if (caseDefinition == null) {
throw new FlowableObjectNotFoundException("Could not find a case definition with id '" + caseDefinitionId + "'.", CaseDefinition.class);
}
return caseDefinition;
}
}
View on GitHub (pinned to d6d39ce1c6)