{"record":{"id":"92be9e92777d7de3","repo":"flowable/flowable-engine","slug":"the-event-definition-id-is-mandatory-but-has-b","errorCode":null,"errorMessage":"The event definition id is mandatory, but '' has been provided.","messagePattern":"The event definition id is mandatory, but '' has been provided\\.","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetEventDefinitionResourceCmd.java","lineNumber":37,"sourceCode":"import org.flowable.common.engine.api.FlowableIllegalArgumentException;\nimport org.flowable.common.engine.impl.interceptor.Command;\nimport org.flowable.common.engine.impl.interceptor.CommandContext;\nimport org.flowable.eventregistry.impl.persistence.entity.EventDefinitionEntity;\nimport org.flowable.eventregistry.impl.util.CommandContextUtil;\n\n/**\n * Gives access to a deployed event model, e.g., an Event definition JSON file, through a stream of bytes.\n * \n * @author Tijs Rademakers\n */\npublic class GetEventDefinitionResourceCmd implements Command<InputStream>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String eventDefinitionId;\n\n    public GetEventDefinitionResourceCmd(String eventDefinitionId) {\n        if (eventDefinitionId == null || eventDefinitionId.length() < 1) {\n            throw new FlowableIllegalArgumentException(\"The event definition id is mandatory, but '\" + eventDefinitionId + \"' has been provided.\");\n        }\n        this.eventDefinitionId = eventDefinitionId;\n    }\n\n    @Override\n    public InputStream execute(CommandContext commandContext) {\n        EventDefinitionEntity eventDefinition = CommandContextUtil.getEventRegistryConfiguration().getDeploymentManager()\n                .findDeployedEventDefinitionById(eventDefinitionId);\n\n        String deploymentId = eventDefinition.getDeploymentId();\n        String resourceName = eventDefinition.getResourceName();\n        InputStream eventDefinitionStream = new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);\n        return eventDefinitionStream;\n    }\n\n}\n","sourceCodeStart":19,"sourceCodeEnd":54,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/GetEventDefinitionResourceCmd.java#L19-L54","documentation":"The GetEventDefinitionResourceCmd constructor validates its only argument: an event definition id that is null or empty (length < 1) triggers FlowableIllegalArgumentException. This fails fast at command construction rather than inside execute.","triggerScenarios":"new GetEventDefinitionResourceCmd(null) or new GetEventDefinitionResourceCmd(\"\") — e.g. id read from an empty config field, missing variable, or empty string from a UI/API request.","commonSituations":"REST call with empty id path param; event definition id column not yet populated; string trimming leaving an empty value; copy-paste of a blank id.","solutions":["Pass a real event definition id (from EventRepositoryService.createEventDefinitionQuery() results)","Validate non-null and non-empty before constructing the command","If the id is user-supplied, add API-layer validation rejecting blank ids"],"exampleFix":"// before\new GetEventDefinitionResourceCmd(eventDefinitionId); // may be \"\"\n// after\nif (eventDefinitionId == null || eventDefinitionId.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"eventDefinitionId is required\");\n}\nnew GetEventDefinitionResourceCmd(eventDefinitionId);","handlingStrategy":"validation","validationCode":"if (eventDefinitionId == null || eventDefinitionId.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"eventDefinitionId required\");\n}","typeGuard":"boolean validId = eventDefinitionId != null && !eventDefinitionId.trim().isEmpty();","tryCatchPattern":"try {\n    InputStream is = new GetEventDefinitionResourceCmd(id).execute(ctx);\n} catch (FlowableIllegalArgumentException e) {\n    log.error(\"Invalid event definition id: {}\", e.getMessage());\n}","preventionTips":["Reject blank ids in controllers/REST layers before reaching the engine","Trim user-supplied ids and re-validate","Query createEventDefinitionQuery() to obtain valid ids"],"tags":["flowable","event-registry","invalid-argument","empty-string"],"backgroundTag":"empty-required-field","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"}