{"record":{"id":"00ee13cd5bb219fd","repo":"flowable/flowable-engine","slug":"channeldefinitionkey-and-channeldefinitionid-are-n","errorCode":null,"errorMessage":"channelDefinitionKey and channelDefinitionId are null","messagePattern":"channelDefinitionKey and channelDefinitionId are null","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetChannelModelCmd.java","lineNumber":144,"sourceCode":"                channelDefinitionEntity = channelDefinitionEntityManager.findLatestChannelDefinitionByKeyAndTenantId(channelDefinitionKey, tenantId);\n            }\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 +\n                        \" for parent deployment id '\" + parentDeploymentId + \"' and for tenant identifier \" + tenantId, ChannelDefinitionEntity.class);\n            }\n\n        } else {\n            throw new FlowableObjectNotFoundException(\"channelDefinitionKey and channelDefinitionId are null\");\n        }\n\n        ChannelDefinitionCacheEntry channelDefinitionCacheEntry = deploymentManager.resolveChannelDefinition(channelDefinitionEntity);\n        return channelDefinitionCacheEntry.getChannelModel();\n    }\n}\n","sourceCodeStart":126,"sourceCodeEnd":151,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetChannelModelCmd.java#L126-L151","documentation":"GetChannelModelCmd resolves a channel definition by id or key and returns its ChannelModel. When both channelDefinitionKey and channelDefinitionId are null there is nothing to look up, so the command throws FlowableObjectNotFoundException with this message. It is a guard against calling the command without any identifier.","triggerScenarios":"Calling managementService/getEventRegistryService channel-model query APIs (e.g. EventRepositoryService.getChannelModel) with null id and null key, or programmatically executing GetChannelModelCmd with both fields unset.","commonSituations":"Building a custom query where the id/key came from an upstream lookup that returned null (e.g. model parsed from JSON with missing channel fields); copying command code and forgetting to set the key; refactoring that dropped the identifier parameter.","solutions":["Ensure the caller supplies either channelDefinitionId or channelDefinitionKey before creating/executing the command","If the identifier comes from upstream data, validate it is non-null and fail early with a clear message","If you need latest version by key, pass the key plus optional tenantId/parentDeploymentId instead of leaving both null"],"exampleFix":"// before\nGetChannelModelCmd cmd = new GetChannelModelCmd(null, null, tenantId, parentDeploymentId);\n// after\nif (channelDefinitionId == null && channelDefinitionKey == null) {\n    throw new IllegalArgumentException(\"channelDefinitionId or channelDefinitionKey is required\");\n}\nGetChannelModelCmd cmd = new GetChannelModelCmd(channelDefinitionId, channelDefinitionKey, tenantId, parentDeploymentId);","handlingStrategy":"validation","validationCode":"if (channelDefinitionId == null && channelDefinitionKey == null) {\n    throw new IllegalArgumentException(\"Provide channelDefinitionId or channelDefinitionKey\");\n}","typeGuard":"boolean hasIdentifier = (id != null) || (key != null && !key.isEmpty());","tryCatchPattern":"try {\n    ChannelModel cm = execCommand(new GetChannelModelCmd(id, key, tenantId, parentDeploymentId));\n} catch (FlowableObjectNotFoundException e) {\n    log.warn(\"Channel definition not found: {}\", e.getMessage());\n}","preventionTips":["Always set at least one of id/key before building the command","Validate upstream data before passing identifiers","Prefer key-based lookup with tenantId for latest-version resolution"],"tags":["flowable","event-registry","null-argument","channel-definition"],"backgroundTag":"missing-required-argument","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"}