{"record":{"id":"31d48de470b4a7ce","repo":"flowable/flowable-engine","slug":"no-channel-definition-found-for-key","errorCode":null,"errorMessage":"No channel definition found for key ''","messagePattern":"No channel definition found for key ''","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetChannelModelCmd.java","lineNumber":76,"sourceCode":"        EventRegistryEngineConfiguration eventEngineConfiguration = CommandContextUtil.getEventRegistryConfiguration(commandContext);\n        EventDeploymentManager deploymentManager = eventEngineConfiguration.getDeploymentManager();\n        ChannelDefinitionEntityManager channelDefinitionEntityManager = eventEngineConfiguration.getChannelDefinitionEntityManager();\n\n        // Find the channel definition\n        ChannelDefinitionEntity channelDefinitionEntity = null;\n        if (channelDefinitionId != null) {\n\n            channelDefinitionEntity = deploymentManager.findDeployedChannelDefinitionById(channelDefinitionId);\n            if (channelDefinitionEntity == null) {\n                throw new FlowableObjectNotFoundException(\"No channel definition found for id = '\" + channelDefinitionId + \"'\", ChannelDefinitionEntity.class);\n            }\n\n        } else if (channelDefinitionKey != null && (tenantId == null || EventRegistryEngineConfiguration.NO_TENANT_ID.equals(tenantId)) && \n                        (parentDeploymentId == null || eventEngineConfiguration.isAlwaysLookupLatestDefinitionVersion())) {\n\n            channelDefinitionEntity = deploymentManager.findDeployedLatestChannelDefinitionByKey(channelDefinitionKey);\n            if (channelDefinitionEntity == null) {\n                throw new FlowableObjectNotFoundException(\"No channel definition found for key '\" + channelDefinitionKey + \"'\", ChannelDefinitionEntity.class);\n            }\n\n        } else if (channelDefinitionKey != null && tenantId != null && !EventRegistryEngineConfiguration.NO_TENANT_ID.equals(tenantId) && \n                        (parentDeploymentId == null || eventEngineConfiguration.isAlwaysLookupLatestDefinitionVersion())) {\n\n            channelDefinitionEntity = channelDefinitionEntityManager.findLatestChannelDefinitionByKeyAndTenantId(channelDefinitionKey, tenantId);\n            \n            if (channelDefinitionEntity == null && eventEngineConfiguration.isFallbackToDefaultTenant()) {\n                String defaultTenant = eventEngineConfiguration.getDefaultTenantProvider().getDefaultTenant(tenantId, ScopeTypes.EVENT_REGISTRY, channelDefinitionKey);\n                if (StringUtils.isNotEmpty(defaultTenant)) {\n                    channelDefinitionEntity = channelDefinitionEntityManager.findLatestChannelDefinitionByKeyAndTenantId(channelDefinitionKey, defaultTenant);\n                } else {\n                    channelDefinitionEntity = channelDefinitionEntityManager.findLatestChannelDefinitionByKey(channelDefinitionKey);\n                }\n            }\n\n            if (channelDefinitionEntity == null) {\n                throw new FlowableObjectNotFoundException(\"No channel definition found for key '\" + channelDefinitionKey + \"' for tenant identifier \" + tenantId, ChannelDefinitionEntity.class);","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetChannelModelCmd.java#L58-L94","documentation":"Thrown when resolving a channel definition by key with no tenant (tenantId null or NO_TENANT_ID) and no parent deployment, and no deployed latest definition exists for that key. FlowableObjectNotFoundException naming the key.","triggerScenarios":"Calling getChannelModel with channelDefinitionKey set (no id), where no channel definition with that key has been deployed, or the deployment containing it was deleted.","commonSituations":"Deploying the channel XML with a different key than the one the application looks up; forgetting to deploy before first use; deleting the deployment that contained the channel.","solutions":["Deploy the channel model XML that defines this key and redeploy","Check the key spelling (case-sensitive) against the deployed definitions: repositoryService.createChannelDefinitionQuery().list()","List deployments to confirm the channel was deployed to this engine/database"],"exampleFix":"// before\nChannelDefinition cd = channelModelLookup(\"inbound-custmr-event\"); // typo, never matches\n// after\nChannelDefinition cd = channelModelLookup(\"inbound-customer-event\"); // key exactly as in XML <channel id=\"inbound-customer-event\">","handlingStrategy":"try-catch","validationCode":"if (repositoryService.createChannelDefinitionQuery()\n        .channelDefinitionKey(key).latest().singleResult() == null) {\n    deployChannelIfNeeded(key); // ensure the channel XML is deployed\n}","typeGuard":null,"tryCatchPattern":"try {\n    return repositoryService.getChannelModel(null, key, null, null);\n} catch (FlowableObjectNotFoundException e) {\n    LOGGER.error(\"no channel deployed for key {}; deployments: {}\", key,\n        repositoryService.createDeploymentQuery().list());\n    throw e;\n}","preventionTips":["Deploy channel models at application startup before any lookups","Keep channel keys in constants shared between deployer and consumer code"],"tags":["flowable","not-found","channel","key"],"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-18T11:17:12.947Z"}