flowable/flowable-engine · error · FlowableObjectNotFoundException

channelDefinitionKey and channelDefinitionId are null

Error message

channelDefinitionKey and channelDefinitionId are null

What it means

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.

Source

Thrown at modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetChannelModelCmd.java:144

                channelDefinitionEntity = channelDefinitionEntityManager.findLatestChannelDefinitionByKeyAndTenantId(channelDefinitionKey, tenantId);
            }
            
            if (channelDefinitionEntity == null && eventEngineConfiguration.isFallbackToDefaultTenant()) {
                String defaultTenant = eventEngineConfiguration.getDefaultTenantProvider().getDefaultTenant(tenantId, ScopeTypes.EVENT_REGISTRY, channelDefinitionKey);
                if (StringUtils.isNotEmpty(defaultTenant)) {
                    channelDefinitionEntity = channelDefinitionEntityManager.findLatestChannelDefinitionByKeyAndTenantId(channelDefinitionKey, defaultTenant);
                } else {
                    channelDefinitionEntity = channelDefinitionEntityManager.findLatestChannelDefinitionByKey(channelDefinitionKey);
                }
            }
            
            if (channelDefinitionEntity == null) {
                throw new FlowableObjectNotFoundException("No channel definition found for key '" + channelDefinitionKey +
                        " for parent deployment id '" + parentDeploymentId + "' and for tenant identifier " + tenantId, ChannelDefinitionEntity.class);
            }

        } else {
            throw new FlowableObjectNotFoundException("channelDefinitionKey and channelDefinitionId are null");
        }

        ChannelDefinitionCacheEntry channelDefinitionCacheEntry = deploymentManager.resolveChannelDefinition(channelDefinitionEntity);
        return channelDefinitionCacheEntry.getChannelModel();
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Ensure the caller supplies either channelDefinitionId or channelDefinitionKey before creating/executing the command
  2. If the identifier comes from upstream data, validate it is non-null and fail early with a clear message
  3. If you need latest version by key, pass the key plus optional tenantId/parentDeploymentId instead of leaving both null

Example fix

// before
GetChannelModelCmd cmd = new GetChannelModelCmd(null, null, tenantId, parentDeploymentId);
// after
if (channelDefinitionId == null && channelDefinitionKey == null) {
    throw new IllegalArgumentException("channelDefinitionId or channelDefinitionKey is required");
}
GetChannelModelCmd cmd = new GetChannelModelCmd(channelDefinitionId, channelDefinitionKey, tenantId, parentDeploymentId);
Defensive patterns

Strategy: validation

Validate before calling

if (channelDefinitionId == null && channelDefinitionKey == null) {
    throw new IllegalArgumentException("Provide channelDefinitionId or channelDefinitionKey");
}

Type guard

boolean hasIdentifier = (id != null) || (key != null && !key.isEmpty());

Try / catch

try {
    ChannelModel cm = execCommand(new GetChannelModelCmd(id, key, tenantId, parentDeploymentId));
} catch (FlowableObjectNotFoundException e) {
    log.warn("Channel definition not found: {}", e.getMessage());
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/00ee13cd5bb219fd. Report an issue: GitHub.