flowable/flowable-engine · error · FlowableIllegalArgumentException
Entity cannot be null.
Error message
Entity cannot be null.
What it means
FlowableEntityExceptionEventImpl is a FlowableEntityEventImpl that additionally carries the Throwable that caused the event (e.g. for ENTITY_CREATED-with-exception style error propagation). It inherits the non-null entity contract: constructing it without an entity throws FlowableIllegalArgumentException, even though the cause itself may legitimately be null per this constructor.
Solutions
- Pass a non-null entity to the constructor; resolve or substitute the entity before creating the event.
- If only the exception matters, use a plain FlowableEventImpl/FlowableExceptionEvent event type not bound to an entity.
- Guard the construction site with a null check and log-and-skip when the entity is absent.
Example fix
// before
events.add(new FlowableEntityExceptionEventImpl(entityRef.get(), type, cause)); // get() may be null
// after
if (entityRef.get() != null) {
events.add(new FlowableEntityExceptionEventImpl(entityRef.get(), type, cause));
} Defensive patterns
Strategy: validation
Validate before calling
if (entity == null) {
log.warn("Skipping exception event dispatch: no entity available");
return;
}
events.add(new FlowableEntityExceptionEventImpl(entity, type, cause)); Type guard
boolean canBuildExceptionEvent(Object entity) { return entity != null; } Try / catch
try {
events.add(new FlowableEntityExceptionEventImpl(entity, type, cause));
} catch (FlowableIllegalArgumentException e) {
log.error("Cannot create entity exception event: entity is null", e);
throw e;
} Prevention
- In error-handling paths, capture the entity reference before the failure can null it out.
- Fall back to a non-entity exception event when the entity is unavailable.
- Assert non-null entity in custom event factories.
When it happens
Trigger: Calling new FlowableEntityExceptionEventImpl(null, type, cause) directly; event-building code in custom error handling where the entity reference is null when the failure event is created.
Common situations: Custom exception/listener plumbing that creates failure events from a null entity (e.g. entity failed to load); test harnesses constructing exception events without an entity; integration code where an earlier lookup returned null.
Related errors
- Entity cannot be null.
- type is null
- Entity cannot be null.
- Entity cannot be null.
- Entity cannot be null.
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/97400bec58d5f5e3.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/event/FlowableEntityExceptionEventImpl.java:34
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
import org.flowable.common.engine.api.delegate.event.FlowableEvent;
import org.flowable.common.engine.api.delegate.event.FlowableExceptionEvent;
/**
* Base class for all {@link FlowableEvent} implementations, represents an exception occurred, related to an entity.
*
* @author Frederik Heremans
*/
public class FlowableEntityExceptionEventImpl extends FlowableEngineEventImpl implements FlowableEngineEntityEvent, FlowableExceptionEvent {
protected Object entity;
protected Throwable cause;
public FlowableEntityExceptionEventImpl(Object entity, FlowableEngineEventType type, Throwable cause) {
super(type);
if (entity == null) {
throw new FlowableIllegalArgumentException("Entity cannot be null.");
}
this.entity = entity;
this.cause = cause;
}
@Override
public Object getEntity() {
return entity;
}
@Override
public Throwable getCause() {
return cause;
}
}
View on GitHub (pinned to d6d39ce1c6)