{"record":{"id":"769b70dc5192f733","repo":"flowable/flowable-engine","slug":"eventdefinitionkey-and-eventdefinitionid-are-null","errorCode":null,"errorMessage":"eventDefinitionKey and eventDefinitionId are null","messagePattern":"eventDefinitionKey and eventDefinitionId are null","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetEventModelCmd.java","lineNumber":144,"sourceCode":"                eventDefinitionEntity = eventDefinitionEntityManager.findLatestEventDefinitionByKeyAndTenantId(eventDefinitionKey, tenantId);\n            }\n            \n            if (eventDefinitionEntity == null && eventEngineConfiguration.isFallbackToDefaultTenant()) {\n                String defaultTenant = eventEngineConfiguration.getDefaultTenantProvider().getDefaultTenant(tenantId, ScopeTypes.EVENT_REGISTRY, eventDefinitionKey);\n                if (StringUtils.isNotEmpty(defaultTenant)) {\n                    eventDefinitionEntity = eventDefinitionEntityManager.findLatestEventDefinitionByKeyAndTenantId(eventDefinitionKey, defaultTenant);\n                } else {\n                    eventDefinitionEntity = eventDefinitionEntityManager.findLatestEventDefinitionByKey(eventDefinitionKey);\n                }\n            }\n            \n            if (eventDefinitionEntity == null) {\n                throw new FlowableObjectNotFoundException(\"No event definition found for key '\" + eventDefinitionKey +\n                        \" for parent deployment id '\" + parentDeploymentId + \"' and for tenant identifier \" + tenantId, EventDefinitionEntity.class);\n            }\n\n        } else {\n            throw new FlowableObjectNotFoundException(\"eventDefinitionKey and eventDefinitionId are null\");\n        }\n\n        EventDefinitionCacheEntry eventDefinitionCacheEntry = deploymentManager.resolveEventDefinition(eventDefinitionEntity);\n        return eventEngineConfiguration.getEventJsonConverter().convertToEventModel(eventDefinitionCacheEntry.getEventDefinitionJson());\n    }\n}\n","sourceCodeStart":126,"sourceCodeEnd":151,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetEventModelCmd.java#L126-L151","documentation":"GetEventModelCmd.execute() requires at least one lookup identifier. When both eventDefinitionKey and eventDefinitionId are null it throws FlowableObjectNotFoundException immediately, before any database access, because there is no way to identify the event definition.","triggerScenarios":"Constructing GetEventModelCmd (or calling the repository API that delegates to it) with neither an event definition id nor key supplied, e.g. passing a null/empty variable from configuration into the command.","commonSituations":"Configuration property not set or a YAML/properties placeholder left unresolved; an API caller that conditionally sets id or key but the condition matched neither; a bug where the wrong variable is passed.","solutions":["Ensure the caller sets either eventDefinitionId or eventDefinitionKey before invoking the lookup.","Fix the configuration source so the key/id is populated (check for empty strings or unresolved placeholders).","Validate inputs in your service layer and fail fast with a clear message before calling the engine."],"exampleFix":"// before\nGetEventModelCmd cmd = new GetEventModelCmd(null, null, null, null); // both id and key null\n// after\nif (eventDefinitionKey == null && eventDefinitionId == null) {\n    throw new IllegalArgumentException(\"eventDefinitionKey or eventDefinitionId must be provided\");\n}\nGetEventModelCmd cmd = new GetEventModelCmd(eventDefinitionId, eventDefinitionKey, null, null);","handlingStrategy":"validation","validationCode":"if (eventDefinitionId == null && (eventDefinitionKey == null || eventDefinitionKey.isBlank())) {\n    throw new IllegalArgumentException(\"Provide eventDefinitionId or eventDefinitionKey\");\n}","typeGuard":"boolean hasIdentifier(String id, String key) {\n    return id != null || (key != null && !key.isBlank());\n}","tryCatchPattern":"try {\n    return eventRepositoryService.getEventModelByKey(key);\n} catch (FlowableObjectNotFoundException e) {\n    throw new ConfigurationException(\"Event lookup called without id/key; check config\", e);\n}","preventionTips":["Validate configuration at startup; fail fast on null keys/ids.","Use typed config objects instead of raw nullable strings.","Log the config source when the identifier is missing."],"tags":["flowable","event-registry","null-argument","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}