flowable/flowable-engine · error · FlowableIllegalArgumentException
event is null
Error message
event is null
What it means
DispatchEventCommand validates that the FlowableEvent to dispatch is non-null and throws FlowableIllegalArgumentException otherwise. The event is then handed to the engine's FlowableEventDispatcher. It exists so a null event fails fast rather than crashing inside dispatcher internals.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DispatchEventCommand.java:40
import org.flowable.engine.impl.util.CommandContextUtil;
/**
* Command that dispatches an event.
*
* @author Frederik Heremans
*/
public class DispatchEventCommand implements Command<Void> {
protected FlowableEvent event;
public DispatchEventCommand(FlowableEvent event) {
this.event = event;
}
@Override
public Void execute(CommandContext commandContext) {
if (event == null) {
throw new FlowableIllegalArgumentException("event is null");
}
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();
if (eventDispatcher != null && eventDispatcher.isEnabled()) {
eventDispatcher.dispatchEvent(event, processEngineConfiguration.getEngineCfgKey());
} else {
throw new FlowableException("Message dispatcher is disabled, cannot dispatch " + event);
}
return null;
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Construct a valid FlowableEvent (e.g. via FlowableEventBuilder) before dispatching.
- Null-check the event at the call site and handle the absent case explicitly.
- Fix factory/builder methods to throw instead of returning null.
- If the event comes from a process variable, add a guard task or validation before the dispatch step.
Example fix
// before
runtimeService.dispatchEvent(myEvent); // myEvent is null
// after
if (myEvent == null) {
throw new IllegalStateException("event required");
}
runtimeService.dispatchEvent(myEvent); Defensive patterns
Strategy: validation
Validate before calling
if (event != null) runtimeService.dispatchEvent(event);
Type guard
if (event instanceof FlowableEvent) { runtimeService.dispatchEvent(event); } Try / catch
try { rs.dispatchEvent(event); } catch (FlowableIllegalArgumentException e) { log.warn("Null event skipped", e); } Prevention
- Make event builders throw instead of returning null
- Guard optional event construction paths
- Type-check event objects produced by reflection or deserialization
When it happens
Trigger: Calling runtimeService.dispatchEvent(null) orFlowableEventDispatcher-enabled command wrappers passing an event variable that was never constructed.
Common situations: Custom event builders returning null on error paths (e.g. factory method returning null instead of throwing); process variables holding the event being null; reflection/dynamic dispatch building the event object incorrectly.
Related errors
- processInstanceId is null
- processInstanceIds are null
- taskId and taskIds are null
- Entity cannot be null.
- Error retrieving app engine info
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/6b8ab578abb745e8.
Report an issue: GitHub.