flowable/flowable-engine · error · FlowableObjectNotFoundException

No case definition found for key <caseDefinitionKey>

Error message

No case definition found for key <caseDefinitionKey>

What it means

CaseInstanceHelperImpl.resolveCaseDefinition could not find any case definition for the given key (and optional tenant), so it throws a FlowableObjectNotFoundException typed to CaseDefinition.class. This happens when starting a case by key or resolving a definition and no deployed case definition matches.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceHelperImpl.java:148

                String defaultTenant = cmmnEngineConfiguration.getDefaultTenantProvider().getDefaultTenant(tenantId, ScopeTypes.CMMN, caseDefinitionKey);
                if (StringUtils.isNotEmpty(defaultTenant)) {
                    caseDefinition = caseDefinitionEntityManager.findLatestCaseDefinitionByKeyAndTenantId(caseDefinitionKey, defaultTenant);
                } else {
                    caseDefinition = caseDefinitionEntityManager.findLatestCaseDefinitionByKey(caseDefinitionKey);
                }
            }
        } else {
            if (parentDeploymentId != null) {
                caseDefinition = caseDefinitionEntityManager.findCaseDefinitionByParentDeploymentAndKey(parentDeploymentId, caseDefinitionKey);
            }
            if (caseDefinition == null) {
                caseDefinition = caseDefinitionEntityManager.findLatestCaseDefinitionByKey(caseDefinitionKey);
            }
        }

        if (caseDefinition == null) {
            if (tenantId == null || CmmnEngineConfiguration.NO_TENANT_ID.equals(tenantId)) {
                throw new FlowableObjectNotFoundException("No case definition found for key " + caseDefinitionKey, CaseDefinition.class);
            } else if (fallbackToDefaultTenant) {
                throw new FlowableObjectNotFoundException(
                        "Case definition was not found by key '" + caseDefinitionKey + "'. Fallback to default tenant was also used.");
            } else {
                throw new FlowableObjectNotFoundException(
                        "Case definition was not found by key '" + caseDefinitionKey + "' and tenant '" + tenantId + "'");
            }
        }

        return caseDefinition;
    }

    protected CaseDefinition getCaseDefinition(CaseInstanceBuilder caseInstanceBuilder, CommandContext commandContext) {
        CaseDefinition caseDefinition = null;
        if (caseInstanceBuilder.getCaseDefinitionId() != null) {
            String caseDefinitionId = caseInstanceBuilder.getCaseDefinitionId();
            CmmnDeploymentManager deploymentManager = cmmnEngineConfiguration.getDeploymentManager();
            caseDefinition = deploymentManager.findDeployedCaseDefinitionById(caseDefinitionId);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Check the key against deployed definitions via CmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionKey(...)
  2. Deploy the case definition (CMMN XML) containing the key before starting the case
  3. Confirm the tenantId matches the deployment's tenant (or pass null / empty for no tenant)
  4. Use the case definition id instead of the key if the exact version is known

Example fix

// before
cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey("orderCase").start(); // not deployed
// after
CaseDefinition cd = cmmnRepositoryService.createCaseDefinitionQuery()
    .caseDefinitionKey("orderCase").latestVersion().singleResult();
if (cd != null) {
    cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionId(cd.getId()).start();
}
Defensive patterns

Strategy: validation

Validate before calling

CaseDefinition cd = cmmnRepositoryService.createCaseDefinitionQuery()
    .caseDefinitionKey("orderCase").latestVersion().singleResult();
if (cd == null) throw new IllegalStateException("Case definition 'orderCase' not deployed");

Try / catch

try {
    cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey(key).start();
} catch (FlowableObjectNotFoundException e) {
    if (e instanceof org.flowable.cmmn.api.runtime.FlowableObjectNotFoundException) {
        // deploy the case model or correct the key
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Starting a case instance via CaseRuntimeServiceImpl by caseDefinitionKey where no deployed definition has that key, and tenantId is null or equals NO_TENANT_ID.

Common situations: Typo in the case key; case model never deployed or deployment failed; querying with the wrong tenant; definition deployed under a different engine/tenant.

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/959eacc82cd62ed8. Report an issue: GitHub.