{"record":{"id":"ffacb49a619ae314","repo":"flowable/flowable-engine","slug":"no-case-definition-found-for-key-casedefinition-ffacb4","errorCode":null,"errorMessage":"No case definition found for key '${caseDefinitionKey}'. Fallback to default tenant was also applied.","messagePattern":"No case definition found for key '(.+?)'\\. Fallback to default tenant was also applied\\.","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractCaseStartEventSubscriptionCmd.java","lineNumber":95,"sourceCode":"            }\n\n        } else if (caseDefinitionKey != null && tenantId != null && !CmmnEngineConfiguration.NO_TENANT_ID.equals(tenantId)) {\n\n            caseDefinition = caseDefinitionEntityManager.findLatestCaseDefinitionByKeyAndTenantId(caseDefinitionKey, tenantId);\n\n            if (caseDefinition == null) {\n                CmmnEngineConfiguration caseEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n                if (caseEngineConfiguration.isFallbackToDefaultTenant()) {\n                    String defaultTenant = caseEngineConfiguration.getDefaultTenantProvider().getDefaultTenant(tenantId, ScopeTypes.BPMN, caseDefinitionKey);\n                    if (StringUtils.isNotEmpty(defaultTenant)) {\n                        caseDefinition = caseDefinitionEntityManager.findLatestCaseDefinitionByKeyAndTenantId(caseDefinitionKey, defaultTenant);\n                        \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) {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractCaseStartEventSubscriptionCmd.java#L77-L113","documentation":"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.","triggerScenarios":"getLatestCaseDefinitionByKey(key, tenantId, ctx) with a non-null tenantId: findLatestCaseDefinitionByKeyAndTenantId returns null, then a fallback findLatestCaseDefinitionByKey also returns null.","commonSituations":"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.","solutions":["Deploy the case definition for the tenantId being used, or deploy it without a tenant so it resolves.","Confirm the tenantId passed to the subscription/instance start matches the tenant of the deployment.","Query case definitions per tenant (caseDefinitionTenantLike/key) to see which tenant actually holds the definition."],"exampleFix":"// before\ncaseInstanceBuilder.caseDefinitionKey(\"order-case\").caseDefinitionTenantId(\"tenant-2\"); // deployed only for tenant-1\n// after\ncaseInstanceBuilder.caseDefinitionKey(\"order-case\").caseDefinitionTenantId(\"tenant-1\");","handlingStrategy":"validation","validationCode":"boolean deployedForTenant = cmmnRepositoryService.createCaseDefinitionQuery()\n    .caseDefinitionKey(key).caseDefinitionTenantId(tenantId).count() > 0\n    || cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).count() > 0;","typeGuard":null,"tryCatchPattern":"try { builder.caseDefinitionKey(key).caseDefinitionTenantId(tenantId).start(); }\ncatch (FlowableObjectNotFoundException e) { retryWithDefaultTenant(); }","preventionTips":["Verify tenantId of deployments right after deployment in integration tests","Use a single source of truth for tenant ids to avoid casing/whitespace drift"],"tags":["cmmn","tenant","case-definition"],"backgroundTag":"record-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"}