flowable/flowable-engine · error · FlowableObjectNotFoundException

No case definition found for key '${caseDefinitionKey}'. Fal

Error message

No case definition found for key '${caseDefinitionKey}'. Fallback to default tenant was also applied.

What it means

FlowableObjectNotFoundException thrown when a case definition with the given key was not found for the requested tenantId and the fallback lookup using the default tenant (NO_TENANT_ID) also returned nothing. It extends error 331 with explicit tenant fallback semantics.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractCaseStartEventSubscriptionCmd.java:95

            }

        } else if (caseDefinitionKey != null && tenantId != null && !CmmnEngineConfiguration.NO_TENANT_ID.equals(tenantId)) {

            caseDefinition = caseDefinitionEntityManager.findLatestCaseDefinitionByKeyAndTenantId(caseDefinitionKey, tenantId);

            if (caseDefinition == null) {
                CmmnEngineConfiguration caseEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
                if (caseEngineConfiguration.isFallbackToDefaultTenant()) {
                    String defaultTenant = caseEngineConfiguration.getDefaultTenantProvider().getDefaultTenant(tenantId, ScopeTypes.BPMN, caseDefinitionKey);
                    if (StringUtils.isNotEmpty(defaultTenant)) {
                        caseDefinition = caseDefinitionEntityManager.findLatestCaseDefinitionByKeyAndTenantId(caseDefinitionKey, defaultTenant);
                        
                    } else {
                        caseDefinition = caseDefinitionEntityManager.findLatestCaseDefinitionByKey(caseDefinitionKey);
                    }
                    
                    if (caseDefinition == null) {
                        throw new FlowableObjectNotFoundException("No case definition found for key '" + caseDefinitionKey +
                            "'. Fallback to default tenant was also applied.", CaseDefinition.class);
                    }
                    
                } else {
                    throw new FlowableObjectNotFoundException("Case definition with key '" + caseDefinitionKey +
                        "' and tenantId '" + tenantId + "' was not found.", CaseDefinition.class);
                }
            }
        }
        
        if (caseDefinition == null) {
            throw new FlowableIllegalArgumentException("No deployed case definition found for key '" + caseDefinitionKey + "'.");
        }
        
        return caseDefinition;
    }

    protected CaseDefinition getCaseDefinitionById(String caseDefinitionId, CommandContext commandContext) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Deploy the case definition for the tenantId being used, or deploy it without a tenant so it resolves.
  2. Confirm the tenantId passed to the subscription/instance start matches the tenant of the deployment.
  3. Query case definitions per tenant (caseDefinitionTenantLike/key) to see which tenant actually holds the definition.

Example fix

// before
caseInstanceBuilder.caseDefinitionKey("order-case").caseDefinitionTenantId("tenant-2"); // deployed only for tenant-1
// after
caseInstanceBuilder.caseDefinitionKey("order-case").caseDefinitionTenantId("tenant-1");
Defensive patterns

Strategy: validation

Validate before calling

boolean deployedForTenant = cmmnRepositoryService.createCaseDefinitionQuery()
    .caseDefinitionKey(key).caseDefinitionTenantId(tenantId).count() > 0
    || cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).count() > 0;

Try / catch

try { builder.caseDefinitionKey(key).caseDefinitionTenantId(tenantId).start(); }
catch (FlowableObjectNotFoundException e) { retryWithDefaultTenant(); }

Prevention

When it happens

Trigger: getLatestCaseDefinitionByKey(key, tenantId, ctx) with a non-null tenantId: findLatestCaseDefinitionByKeyAndTenantId returns null, then a fallback findLatestCaseDefinitionByKey also returns null.

Common situations: Case definition deployed only under the default tenant while the runtime request specifies another tenantId (or vice versa); tenantId misconfigured in the engine config or in the event registry deployment.

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


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