flowable/flowable-engine · error · FlowableIllegalArgumentException

No deployed case definition found for key

Error message

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

What it means

FlowableIllegalArgumentException thrown as the last-resort check in getLatestCaseDefinitionByKey: after all lookup paths the caseDefinition variable is still null, so no deployed case definition exists for the key at all.

Solutions

  1. Deploy the case definition with the expected key before triggering the subscription command.
  2. List deployed case definitions (repositoryService.createCaseDefinitionQuery().caseDefinitionKey(key)) to confirm presence.
  3. Correct the key referenced in the event-registry inbound start-event mapping.

Example fix

// before (subscription created before deployment)
createSubscription(caseDefinitionKey); // key not yet deployed
// after
deploy(cmmnModel);
createSubscription(caseDefinitionKey);
Defensive patterns

Strategy: validation

Validate before calling

long n = cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).count();
if (n == 0) deploy(cmmnModel);

Try / catch

try { createSubscription(key); }
catch (FlowableIllegalArgumentException e) { if (e.getMessage().startsWith("No deployed case definition")) { deployAndRetry(key); } }

Prevention

When it happens

Trigger: Reached when neither the no-tenant branch nor the tenant branch produced a definition (e.g., an unexpected combination leaves caseDefinition null after the if/else chain).

Common situations: Case model never deployed; deployment removed from the database; key mismatch between the case element's start-event mapping and the deployed case.

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

Appendix: source

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

                        
                    } 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) {
        CmmnRepositoryService repositoryService = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getCmmnRepositoryService();

        CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery()
            .caseDefinitionId(caseDefinitionId)
            .singleResult();

        if (caseDefinition == null) {
            throw new FlowableIllegalArgumentException("No deployed case definition found for id '" + caseDefinitionId + "'.");
        }
        return caseDefinition;
    }

View on GitHub (pinned to d6d39ce1c6)