{"record":{"id":"a8da36ea59bbe1dc","repo":"flowable/flowable-engine","slug":"no-deployed-case-definition-found-for-key-cased","errorCode":null,"errorMessage":"No deployed case definition found for key '${caseDefinitionKey}'.","messagePattern":"No deployed case definition found for key '(.+?)'\\.","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractCaseStartEventSubscriptionCmd.java","lineNumber":107,"sourceCode":"                        \n                    } else {\n                        caseDefinition = caseDefinitionEntityManager.findLatestCaseDefinitionByKey(caseDefinitionKey);\n                    }\n                    \n                    if (caseDefinition == null) {\n                        throw new FlowableObjectNotFoundException(\"No case definition found for key '\" + caseDefinitionKey +\n                            \"'. Fallback to default tenant was also applied.\", CaseDefinition.class);\n                    }\n                    \n                } else {\n                    throw new FlowableObjectNotFoundException(\"Case definition with key '\" + caseDefinitionKey +\n                        \"' and tenantId '\" + tenantId + \"' was not found.\", CaseDefinition.class);\n                }\n            }\n        }\n        \n        if (caseDefinition == null) {\n            throw new FlowableIllegalArgumentException(\"No deployed case definition found for key '\" + caseDefinitionKey + \"'.\");\n        }\n        \n        return caseDefinition;\n    }\n\n    protected CaseDefinition getCaseDefinitionById(String caseDefinitionId, CommandContext commandContext) {\n        CmmnRepositoryService repositoryService = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getCmmnRepositoryService();\n\n        CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery()\n            .caseDefinitionId(caseDefinitionId)\n            .singleResult();\n\n        if (caseDefinition == null) {\n            throw new FlowableIllegalArgumentException(\"No deployed case definition found for id '\" + caseDefinitionId + \"'.\");\n        }\n        return caseDefinition;\n    }\n","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractCaseStartEventSubscriptionCmd.java#L89-L125","documentation":"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.","triggerScenarios":"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).","commonSituations":"Case model never deployed; deployment removed from the database; key mismatch between the case element's start-event mapping and the deployed case.","solutions":["Deploy the case definition with the expected key before triggering the subscription command.","List deployed case definitions (repositoryService.createCaseDefinitionQuery().caseDefinitionKey(key)) to confirm presence.","Correct the key referenced in the event-registry inbound start-event mapping."],"exampleFix":"// before (subscription created before deployment)\ncreateSubscription(caseDefinitionKey); // key not yet deployed\n// after\ndeploy(cmmnModel);\ncreateSubscription(caseDefinitionKey);","handlingStrategy":"validation","validationCode":"long n = cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).count();\nif (n == 0) deploy(cmmnModel);","typeGuard":null,"tryCatchPattern":"try { createSubscription(key); }\ncatch (FlowableIllegalArgumentException e) { if (e.getMessage().startsWith(\"No deployed case definition\")) { deployAndRetry(key); } }","preventionTips":["Ensure deployment order: CMMN model first, then event subscriptions","Guard against deployment cleanup deleting definitions still referenced by subscriptions"],"tags":["cmmn","case-definition","deployment"],"backgroundTag":"resource-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}