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

BaseCaseDefinitionResource.getCaseDefinitionFromRequestWithoutAccessCheck looks up a case definition by id via repositoryService.getCaseDefinition. When no case definition exists for the given id, it throws FlowableObjectNotFoundException carrying CaseDefinition.class so REST mappings translate it to a 404.

Solutions

  1. Verify the id by listing definitions: GET /cmmn-repository/case-definitions and copy the exact 'id'.
  2. Check you are not confusing the definition 'key' with the 'id'; the endpoint requires the id.
  3. Confirm the CMMN deployment still exists and was not removed (check /cmmn-repository/deployments).
  4. Ensure the REST service connects to the same database/tenant where the definition is deployed.

Example fix

// before
GET /cmmn-repository/case-definitions/myCase  // key, not id
// after
GET /cmmn-repository/case-definitions        // find exact id
GET /cmmn-repository/case-definitions/caseOrderProcess:1:104
Defensive patterns

Strategy: try-catch

Validate before calling

const defs = await get('/cmmn-repository/case-definitions');
const exists = defs.data.some(d => d.id === caseDefinitionId);
if (!exists) throw new Error(`Unknown case definition id: ${caseDefinitionId}`);

Try / catch

try {
  const def = await getCaseDefinition(id);
} catch (e) {
  if (e.response?.status === 404 && /case definition/.test(e.response.data?.message)) {
    // refresh id from /case-definitions list and retry once
  } else throw e;
}

Prevention

When it happens

Trigger: Any REST call resolving a case definition path variable, e.g. GET /cmmn-repository/case-definitions/{caseDefinitionId} or POST .../case-definitions/{id}/identity-links, where the id does not match a deployed case definition.

Common situations: Typos in the definition id; referencing a definition that was deleted by a redeploy/cleanup; using a case definition key instead of id; querying a different tenant/database than where it was deployed.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/cade397d62538fe4. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/BaseCaseDefinitionResource.java:59

    protected CaseDefinition getCaseDefinitionFromRequest(String caseDefinitionId) {
        CaseDefinition caseDefinition = getCaseDefinitionFromRequestWithoutAccessCheck(caseDefinitionId);

        if (restApiInterceptor != null) {
            restApiInterceptor.accessCaseDefinitionById(caseDefinition);
        }

        return caseDefinition;
    }

    /**
     * Returns the {@link CaseDefinition} that is requested without calling the access interceptor
     * Throws the right exceptions when bad request was made or definition was not found.
     */
    protected CaseDefinition getCaseDefinitionFromRequestWithoutAccessCheck(String caseDefinitionId) {
        CaseDefinition caseDefinition = repositoryService.getCaseDefinition(caseDefinitionId);

        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)