flowable/flowable-engine · error · ActivitiIllegalArgumentException
event is null
Error message
event is null
What it means
DispatchEventCommand dispatches a FlowableEvent through the engine's event dispatcher. Before dispatching, it validates that the event supplied to the command is not null; a null event would otherwise cause a NullPointerException deep inside the dispatcher, so an ActivitiIllegalArgumentException is thrown explicitly.
Solutions
- Ensure the event passed to runtimeService.dispatchEvent() is non-null before calling it
- Verify the event factory (e.g. FlowableEventBuilder) call used to create the event actually succeeded
- Check that variables holding the event are initialized before the dispatch call
- Wrap the dispatch call in a null check or Objects.requireNonNull with a clear message
Example fix
// before
runtimeService.dispatchEvent(event);
// after
if (event != null) {
runtimeService.dispatchEvent(event);
} else {
throw new IllegalArgumentException("Cannot dispatch: event is null");
} Defensive patterns
Strategy: validation
Validate before calling
if (event == null) { throw new IllegalArgumentException("event must not be null before dispatch"); } Type guard
boolean isDispatchable(ActivitiEvent e) { return e != null; } Try / catch
try { runtimeService.dispatchEvent(event); } catch (ActivitiIllegalArgumentException e) { LOGGER.error("Null event passed to dispatch", e); } Prevention
- Never dispatch events built by conditional helpers without a null check
- Use Objects.requireNonNull(event) at the dispatch call site
- Unit test event-producing helpers to assert non-null output
When it happens
Trigger: Calling RuntimeService.dispatchEvent(event) (or DispatchEventCmd via the command API) with a null ActivitiEvent, e.g. a variable holding the event was never initialized or a builder/factory returned null.
Common situations: Custom event listeners or integration code that builds events conditionally and passes the result straight to dispatchEvent; refactors where an event-creation helper silently started returning null.
Related errors
- comment is null
- Deployment id is null
- executionId is null
- Invalid case definition id : null
- model is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/d08bcda338cca4ff.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/DispatchEventCommand.java:38
import org.flowable.common.engine.impl.interceptor.EngineConfigurationConstants;
/**
* 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 ActivitiIllegalArgumentException("event is null");
}
if (commandContext.getEventDispatcher().isEnabled()) {
commandContext.getEventDispatcher().dispatchEvent(event, EngineConfigurationConstants.KEY_PROCESS_ENGINE_CONFIG);
} else {
throw new ActivitiException("Message dispatcher is disabled, cannot dispatch event");
}
return null;
}
}
View on GitHub (pinned to d6d39ce1c6)