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
FlowableIllegalArgumentException thrown by getEventModel when the event repository service cannot find an event model for the given eventDefinitionKey (and tenantId). A case start-event subscription requires the referenced event model to be deployed in the event registry.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractCaseStartEventSubscriptionCmd.java:135
.caseDefinitionId(caseDefinitionId)
.singleResult();
if (caseDefinition == null) {
throw new FlowableIllegalArgumentException("No deployed case definition found for id '" + caseDefinitionId + "'.");
}
return caseDefinition;
}
protected Case getCase(String caseDefinitionId, CommandContext commandContext) {
CmmnRepositoryService repositoryService = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getCmmnRepositoryService();
CmmnModel cmmnModel = repositoryService.getCmmnModel(caseDefinitionId);
return cmmnModel.getPrimaryCase();
}
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 String getStartCorrelationConfiguration(String caseDefinitionId, CommandContext commandContext) {
CmmnModel cmmnModel = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getCmmnRepositoryService().getCmmnModel(caseDefinitionId);
if (cmmnModel != null) {
List<ExtensionElement> correlationCfgExtensions = cmmnModel.getPrimaryCase().getExtensionElements()
.getOrDefault(CmmnXmlConstants.START_EVENT_CORRELATION_CONFIGURATION, Collections.emptyList());
if (!correlationCfgExtensions.isEmpty()) {
return correlationCfgExtensions.get(0).getElementText();
}
}
return null;
}
protected EventSubscriptionService getEventSubscriptionService(CommandContext commandContext) {
return CommandContextUtil.getCmmnEngineConfiguration(commandContext).getEventSubscriptionServiceConfiguration().getEventSubscriptionService();View on GitHub (pinned to d6d39ce1c6)
Solutions
- Deploy the event model (.event resource) containing the referenced key via the event registry repository service.
- Fix the eventDefinitionKey in the CMMN model so it matches the deployed event model key.
- Verify tenant consistency: query getEventModelByKey with the same tenantId used at deployment.
Example fix
// before (case model references) <startEvent id="start" flowable:eventKey="orderRecieved" /> // typo // after <startEvent id="start" flowable:eventKey="orderReceived" />
Defensive patterns
Strategy: validation
Validate before calling
EventModel em = eventRepositoryService.getEventModelByKey(eventKey, tenantId);
if (em == null) throw new IllegalStateException("deploy event model for key " + eventKey); Try / catch
try { subscribe(caseKey, eventKey); }
catch (FlowableIllegalArgumentException e) { if (e.getMessage().contains("Could not find event model")) { deployEventResources(); throw e; } } Prevention
- Package .event resources together with the CMMN model in the same deployment
- Validate event keys referenced in case diagrams at build time against the event registry
When it happens
Trigger: AbstractCaseStartEventSubscriptionCmd.getEventModel(key, tenantId, ctx) where getEventModelByKey returns null — the event definition key in the case model's start-event mapping has no matching deployed event model.
Common situations: Event registry artifacts (.event JSON) not deployed alongside the CMMN model; event key typo in the case diagram's start event; event model deployed under a different tenantId than requested.
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
- Could not resolve key from expression:
- No event model found for event key ${key} for ${planItemInst
- Can only use a collection of String elements for referencing
- No channel keys configured for ${planItemInstanceEntity}
- The case definition with id
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/719015a094d7f9cf.
Report an issue: GitHub.