flowable/flowable-engine · error · FlowableObjectNotFoundException

No event definition found for id = ''

Error message

No event definition found for id = ''

What it means

GetEventModelCmd resolves an EventDefinitionEntity and returns its EventModel. When eventDefinitionId is provided but no deployed event definition with that id exists, deploymentManager.findDeployedEventDefinitionById returns null and the command throws FlowableObjectNotFoundException including the id.

Source

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

    public GetEventModelCmd(String eventDefinitionKey, String tenantId, String parentDeploymentId) {
        this(eventDefinitionKey, null);
        this.parentDeploymentId = parentDeploymentId;
        this.tenantId = tenantId;
    }

    @Override
    public EventModel execute(CommandContext commandContext) {
        EventRegistryEngineConfiguration eventEngineConfiguration = CommandContextUtil.getEventRegistryConfiguration(commandContext);
        EventDeploymentManager deploymentManager = eventEngineConfiguration.getDeploymentManager();
        EventDefinitionEntityManager eventDefinitionEntityManager = eventEngineConfiguration.getEventDefinitionEntityManager();

        // Find the event definition
        EventDefinitionEntity eventDefinitionEntity = null;
        if (eventDefinitionId != null) {

            eventDefinitionEntity = deploymentManager.findDeployedEventDefinitionById(eventDefinitionId);
            if (eventDefinitionEntity == null) {
                throw new FlowableObjectNotFoundException("No event definition found for id = '" + eventDefinitionId + "'", EventDefinitionEntity.class);
            }

        } else if (eventDefinitionKey != null && (tenantId == null || EventRegistryEngineConfiguration.NO_TENANT_ID.equals(tenantId)) && 
                        (parentDeploymentId == null || eventEngineConfiguration.isAlwaysLookupLatestDefinitionVersion())) {

            eventDefinitionEntity = deploymentManager.findDeployedLatestEventDefinitionByKey(eventDefinitionKey);
            if (eventDefinitionEntity == null) {
                throw new FlowableObjectNotFoundException("No event definition found for key '" + eventDefinitionKey + "'", EventDefinitionEntity.class);
            }

        } else if (eventDefinitionKey != null && tenantId != null && !EventRegistryEngineConfiguration.NO_TENANT_ID.equals(tenantId) && 
                        (parentDeploymentId == null || eventEngineConfiguration.isAlwaysLookupLatestDefinitionVersion())) {

            eventDefinitionEntity = eventDefinitionEntityManager.findLatestEventDefinitionByKeyAndTenantId(eventDefinitionKey, tenantId);
            
            if (eventDefinitionEntity == null && eventEngineConfiguration.isFallbackToDefaultTenant()) {
                String defaultTenant = eventEngineConfiguration.getDefaultTenantProvider().getDefaultTenant(tenantId, ScopeTypes.EVENT_REGISTRY, eventDefinitionKey);
                if (StringUtils.isNotEmpty(defaultTenant)) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Look up valid ids via EventRepositoryService.createEventDefinitionQuery().list() and use one of those
  2. Redeploy the event definition if it was removed
  3. Check you are connected to the same database/engine where the definition was deployed

Example fix

// before
EventModel model = eventRepositoryService.getEventModelById(staleId);
// after
EventDefinition def = eventRepositoryService.createEventDefinitionQuery()
    .eventDefinitionId(eventDefinitionId).singleResult();
if (def == null) {
    eventRepositoryService.createDeployment().addClasspathResource("order.event.json").deploy();
}
EventModel model = eventRepositoryService.getEventModelById(eventDefinitionId);
Defensive patterns

Strategy: try-catch

Validate before calling

EventDefinition def = eventRepositoryService.createEventDefinitionQuery().eventDefinitionId(id).singleResult();
if (def == null) throw new IllegalArgumentException("No event definition: " + id);

Type guard

boolean eventDefinitionExists = eventRepositoryService.createEventDefinitionQuery().eventDefinitionId(id).count() > 0;

Try / catch

try {
    return eventRepositoryService.getEventModelById(id);
} catch (FlowableObjectNotFoundException e) {
    log.warn("Event definition {} missing; redeploying", id);
    redeployEventModels();
    return eventRepositoryService.getEventModelById(id);
}

Prevention

When it happens

Trigger: Executing GetEventModelCmd with an eventDefinitionId that was never deployed, was deleted by a redeploy/cleanup, or belongs to a different event-registry database/tenant.

Common situations: Hard-coded ids from another environment; stale cache of ids after deployment deletion; using a process definition id with the event registry; DB not migrated (missing event definition rows).

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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