{"record":{"id":"0d997a6583edcc81","repo":"flowable/flowable-engine","slug":"event-definition-id-is-null","errorCode":null,"errorMessage":"Event definition id is null","messagePattern":"Event definition id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/SetEventDefinitionCategoryCmd.java","lineNumber":42,"sourceCode":"/**\n * @author Tijs Rademakers\n * @author Joram Barrez\n */\npublic class SetEventDefinitionCategoryCmd implements Command<Void> {\n\n    protected String eventDefinitionId;\n    protected String category;\n\n    public SetEventDefinitionCategoryCmd(String eventDefinitionId, String category) {\n        this.eventDefinitionId = eventDefinitionId;\n        this.category = category;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n\n        if (eventDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"Event definition id is null\");\n        }\n\n        EventDefinitionEntity eventDefinition = CommandContextUtil.getEventDefinitionEntityManager(commandContext).findById(eventDefinitionId);\n\n        if (eventDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"No event definition found for id = '\" + eventDefinitionId + \"'\");\n        }\n\n        // Update category\n        eventDefinition.setCategory(category);\n\n        // Remove form from cache, it will be refetch later\n        DeploymentCache<EventDefinitionCacheEntry> eventDefinitionCache = CommandContextUtil.getEventRegistryConfiguration().getEventDefinitionCache();\n        if (eventDefinitionCache != null) {\n            eventDefinitionCache.remove(eventDefinitionId);\n        }\n\n        CommandContextUtil.getEventDefinitionEntityManager(commandContext).update(eventDefinition);","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/SetEventDefinitionCategoryCmd.java#L24-L60","documentation":"SetEventDefinitionCategoryCmd throws FlowableIllegalArgumentException when the eventDefinitionId passed to the command is null. This is a fail-fast guard at the start of execute() before any database lookup is attempted.","triggerScenarios":"Calling eventRepositoryService.setEventDefinitionCategory(null, category) or building SetEventDefinitionCategoryCmd with a null id, typically when the id comes from an unset variable, a failed lookup, or an unpopulated DTO.","commonSituations":"Programmatically assembling commands where the event definition id was never resolved, copying code from process definitions (same API shape) but passing a process definition id variable that is null, or deserialization producing null fields.","solutions":["Ensure a non-null eventDefinitionId is passed; resolve it via EventRepositoryService.createEventDefinitionQuery() first.","Add a caller-side null/blank check before invoking the command and fail early with your own message.","Trace where the id originates (config, previous API response) and fix the upstream resolution."],"exampleFix":"// before\neventRepositoryService.setEventDefinitionCategory(eventDefinitionId, \"myCategory\");\n// after\nif (eventDefinitionId != null && !eventDefinitionId.isBlank()) {\n    eventRepositoryService.setEventDefinitionCategory(eventDefinitionId, \"myCategory\");\n}","handlingStrategy":"validation","validationCode":"if (eventDefinitionId == null || eventDefinitionId.isBlank()) throw new IllegalArgumentException(\"eventDefinitionId required\");","typeGuard":null,"tryCatchPattern":"try { svc.setEventDefinitionCategory(id, cat); } catch (FlowableIllegalArgumentException e) { log.error(\"Null event definition id\"); }","preventionTips":["Null-check ids resolved from earlier queries before passing them on","Fail fast at DTO/parameter construction boundaries","Prefer resolving definitions by key in one query step"],"tags":["flowable","event-registry","null-argument","validation"],"backgroundTag":"null-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"}