flowable/flowable-engine · error · FlowableIllegalArgumentException

Could not find event model with key '{eventDefinitionKey}'.

Error message

Could not find event model with key '{eventDefinitionKey}'.

What it means

getEventModel fetches an EventModel from the event registry by key and tenant; when the event repository service returns null this FlowableIllegalArgumentException is thrown. The process start event subscription depends on an event registry model that must have been deployed.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractProcessStartEventSubscriptionCmd.java:133

            .processDefinitionId(processDefinitionId)
            .singleResult();

        if (processDefinition == null) {
            throw new FlowableIllegalArgumentException("No deployed process definition found for id '" + processDefinitionId + "'.");
        }
        return processDefinition;
    }

    protected Process getProcess(String processDefinitionId, CommandContext commandContext) {
        RepositoryService repositoryService = CommandContextUtil.getProcessEngineConfiguration(commandContext).getRepositoryService();
        BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
        return bpmnModel.getMainProcess();
    }

    protected EventModel getEventModel(String eventDefinitionKey, String tenantId, CommandContext commandContext) {
        EventModel eventModel = CommandContextUtil.getEventRepositoryService(commandContext).getEventModelByKey(eventDefinitionKey, tenantId);
        if (eventModel == null) {
            throw new FlowableIllegalArgumentException("Could not find event model with key '" + eventDefinitionKey + "'.");
        }
        return eventModel;
    }

    protected EventSubscriptionService getEventSubscriptionService(CommandContext commandContext) {
        return CommandContextUtil.getProcessEngineConfiguration(commandContext).getEventSubscriptionServiceConfiguration().getEventSubscriptionService();
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Deploy the event model: repositoryService/EventRegistry deployment including the .event resource (createDeployment().addClasspathResource("myevent.event").deploy())
  2. Confirm the key matches the model's key attribute and the tenant matches the deployment
  3. List available models via the event repository service / EVENTregistry tables to find the right key
  4. Ensure flowable-event-registry schema is present in the database

Example fix

// before
// only BPMN deployed; correlation on 'customerCreated' event fails
// after
repositoryService.createDeployment()
    .addClasspathResource("customerCreated.event")
    .tenantId("acme")
    .deploy();
Defensive patterns

Strategy: validation

Validate before calling

EventModel model = eventRepositoryService.getEventModelByKey(eventKey, tenantId);
if (model == null) throw new IllegalStateException("Event model not deployed: " + eventKey);

Try / catch

try {
    // event correlation/registration
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().contains("Could not find event model")) {
        // deploy missing .event resource or report missing event definition
    }
}

Prevention

When it happens

Trigger: Correlating/starting via a process start event whose eventDefinitionKey has no deployed EventModel for the given tenant (getEventModelByKey returned null).

Common situations: Event registry model (.event JSON) not included in the deployment; event key typo; model deployed to another tenant; event-registry tables missing from this environment.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — 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/50d86f2a927e6091. Report an issue: GitHub.