{"record":{"id":"50d86f2a927e6091","repo":"flowable/flowable-engine","slug":"could-not-find-event-model-with-key-eventdefinit","errorCode":null,"errorMessage":"Could not find event model with key '{eventDefinitionKey}'.","messagePattern":"Could not find event model with key '(.+?)'\\.","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractProcessStartEventSubscriptionCmd.java","lineNumber":133,"sourceCode":"            .processDefinitionId(processDefinitionId)\n            .singleResult();\n\n        if (processDefinition == null) {\n            throw new FlowableIllegalArgumentException(\"No deployed process definition found for id '\" + processDefinitionId + \"'.\");\n        }\n        return processDefinition;\n    }\n\n    protected Process getProcess(String processDefinitionId, CommandContext commandContext) {\n        RepositoryService repositoryService = CommandContextUtil.getProcessEngineConfiguration(commandContext).getRepositoryService();\n        BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);\n        return bpmnModel.getMainProcess();\n    }\n\n    protected EventModel getEventModel(String eventDefinitionKey, String tenantId, CommandContext commandContext) {\n        EventModel eventModel = CommandContextUtil.getEventRepositoryService(commandContext).getEventModelByKey(eventDefinitionKey, tenantId);\n        if (eventModel == null) {\n            throw new FlowableIllegalArgumentException(\"Could not find event model with key '\" + eventDefinitionKey + \"'.\");\n        }\n        return eventModel;\n    }\n\n    protected EventSubscriptionService getEventSubscriptionService(CommandContext commandContext) {\n        return CommandContextUtil.getProcessEngineConfiguration(commandContext).getEventSubscriptionServiceConfiguration().getEventSubscriptionService();\n    }\n}\n","sourceCodeStart":115,"sourceCodeEnd":142,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractProcessStartEventSubscriptionCmd.java#L115-L142","documentation":"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.","triggerScenarios":"Correlating/starting via a process start event whose eventDefinitionKey has no deployed EventModel for the given tenant (getEventModelByKey returned null).","commonSituations":"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.","solutions":["Deploy the event model: repositoryService/EventRegistry deployment including the .event resource (createDeployment().addClasspathResource(\"myevent.event\").deploy())","Confirm the key matches the model's key attribute and the tenant matches the deployment","List available models via the event repository service / EVENTregistry tables to find the right key","Ensure flowable-event-registry schema is present in the database"],"exampleFix":"// before\n// only BPMN deployed; correlation on 'customerCreated' event fails\n// after\nrepositoryService.createDeployment()\n    .addClasspathResource(\"customerCreated.event\")\n    .tenantId(\"acme\")\n    .deploy();","handlingStrategy":"validation","validationCode":"EventModel model = eventRepositoryService.getEventModelByKey(eventKey, tenantId);\nif (model == null) throw new IllegalStateException(\"Event model not deployed: \" + eventKey);","typeGuard":null,"tryCatchPattern":"try {\n    // event correlation/registration\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"Could not find event model\")) {\n        // deploy missing .event resource or report missing event definition\n    }\n}","preventionTips":["Package .event resources together with the BPMN deployment","Keep event keys in shared constants used by both producers and deployments","Verify event-registry schema exists in each environment's DB"],"tags":["flowable","event-registry","event-model","not-found"],"backgroundTag":"resource-not-found","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"}