{"record":{"id":"0c6951d62be5ea98","repo":"flowable/flowable-engine","slug":"no-channel-definition-found-for-id","errorCode":null,"errorMessage":"No channel definition found for id = ''","messagePattern":"No channel definition found for id = ''","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetChannelModelCmd.java","lineNumber":68,"sourceCode":"    public GetChannelModelCmd(String channelDefinitionKey, String tenantId, String parentDeploymentId) {\n        this(channelDefinitionKey, null);\n        this.tenantId = tenantId;\n        this.parentDeploymentId = parentDeploymentId;\n    }\n\n    @Override\n    public ChannelModel execute(CommandContext commandContext) {\n        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)) {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetChannelModelCmd.java#L50-L86","documentation":"Thrown when looking up a channel definition by explicit channelDefinitionId and the deployment manager finds no deployed ChannelDefinitionEntity with that id. FlowableObjectNotFoundException carrying the id and ChannelDefinitionEntity type; the id was syntactically accepted but does not reference a deployed definition.","triggerScenarios":"Calling getChannelModel / getChannelDefinitionModel with a channelDefinitionId that was never deployed, was already deleted with its deployment, or belongs to a different engine's schema/database.","commonSituations":"Stale id cached in client code after redeployment; id copied from a test environment database; deployment deleted concurrently; typos in the id.","solutions":["Query the repository for the valid id first: repositoryService.createChannelDefinitionQuery().list() and use a returned id","Verify the deployment containing this id still exists and wasn't deleted","Check you are connected to the same database/environment the id was created in"],"exampleFix":"// before\nChannelDefinition cd = repositoryService.getChannelDefinition(knownId); // stale id\n// after\nChannelDefinition cd = repositoryService.createChannelDefinitionQuery()\n    .channelDefinitionId(knownId).singleResult();\nif (cd == null) {\n    cd = repositoryService.createChannelDefinitionQuery().latestVersion().singleResult();\n}","handlingStrategy":"try-catch","validationCode":"ChannelDefinition existing = repositoryService.createChannelDefinitionQuery()\n    .channelDefinitionId(channelDefinitionId).singleResult();\nif (existing == null) throw new IllegalStateException(\"unknown channel definition id \" + channelDefinitionId);","typeGuard":null,"tryCatchPattern":"try {\n    return repositoryService.getChannelModel(id, null, null, null);\n} catch (FlowableObjectNotFoundException e) {\n    LOGGER.warn(\"channel definition {} not found; refreshing ids\", id);\n    return repositoryService.createChannelDefinitionQuery().latestVersion().singleResult();\n}","preventionTips":["Resolve ids via ChannelDefinitionQuery instead of caching them across redeployments","Validate ids from external input against the deployed set first"],"tags":["flowable","not-found","channel","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"}