flowable/flowable-engine · error · FlowableIllegalArgumentException
occurredBefore is null
Error message
occurredBefore is null
What it means
Flowable throws FlowableIllegalArgumentException when planItemInstanceOccurredBefore(Date) receives a null Date. Query criteria methods validate arguments eagerly so invalid queries fail at build time instead of at SQL execution. A null filter value should be expressed by not calling the method at all.
Solutions
- Provide a concrete Date before calling planItemInstanceOccurredBefore.
- Guard the call site with a null check and skip the method when the value is absent.
- Parse string inputs explicitly and reject empty/invalid values before query construction.
- Catch FlowableIllegalArgumentException around query building to surface a meaningful validation error.
Example fix
// before
query.planItemInstanceOccurredBefore(input.getOccurredBefore()); // null when unset
// after
if (input.getOccurredBefore() != null) {
query.planItemInstanceOccurredBefore(input.getOccurredBefore());
} Defensive patterns
Strategy: validation
Validate before calling
if (occurredBefore == null) {
throw new IllegalArgumentException("occurredBefore must be non-null; omit the filter instead");
}
query.planItemInstanceOccurredBefore(occurredBefore); Type guard
boolean hasOccurredBefore = (occurredBefore != null);
Try / catch
try {
query.planItemInstanceOccurredBefore(occurredBefore);
} catch (FlowableIllegalArgumentException e) {
if (e.getMessage().contains("occurredBefore")) {
throw new BadRequestException("occurredBefore date filter must not be null");
}
throw e;
} Prevention
- Apply query criteria only when the date value is present
- Validate optional request parameters before query construction
- Use a query-builder helper that skips null filters
- Fail fast on empty date inputs at the API boundary
When it happens
Trigger: Calling createPlanItemInstanceQuery().planItemInstanceOccurredBefore(null), e.g. when the before-date originates from an optional client parameter or an unset DTO field.
Common situations: Web layer forwarding a missing 'occurredBefore' request parameter; deserialization leaving the field null; a failed date conversion returning null.
Related errors
- activatedBefore is null
- activity tenant id is null
- after time is null
- category is null
- categoryLike is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/d92f34cf5e95aef1.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java:545
}
@Override
public PlanItemInstanceQuery planItemInstanceCompletedAfter(Date completedAfter) {
if (completedAfter == null) {
throw new FlowableIllegalArgumentException("completedAfter is null");
}
if (inOrStatement) {
this.currentOrQueryObject.completedAfter = completedAfter;
} else {
this.completedAfter = completedAfter;
}
return this;
}
@Override
public PlanItemInstanceQuery planItemInstanceOccurredBefore(Date occurredBefore) {
if (occurredBefore == null) {
throw new FlowableIllegalArgumentException("occurredBefore is null");
}
if (inOrStatement) {
this.currentOrQueryObject.occurredBefore = occurredBefore;
} else {
this.occurredBefore = occurredBefore;
}
return this;
}
@Override
public PlanItemInstanceQuery planItemInstanceOccurredAfter(Date occurredAfter) {
if (occurredAfter == null) {
throw new FlowableIllegalArgumentException("occurredAfter is null");
}
if (inOrStatement) {
this.currentOrQueryObject.occurredAfter = occurredAfter;
} else {
this.occurredAfter = occurredAfter;View on GitHub (pinned to d6d39ce1c6)