flowable/flowable-engine · error · FlowableIllegalArgumentException
enabledAfter is null
Error message
enabledAfter is null
What it means
planItemInstanceLastEnabledAfter(Date) throws FlowableIllegalArgumentException with message 'enabledAfter is null' when given a null Date. The CMMN query builder validates each date filter eagerly so invalid queries fail at call time rather than at query execution. Null is not a valid filter bound.
Solutions
- Supply a real Date instance to the method.
- Conditionally chain the filter only when the value is non-null.
- Coalesce to a sensible default date before calling.
- Catch FlowableIllegalArgumentException and rebuild the query without the filter if null is acceptable.
Example fix
// before
query.planItemInstanceLastEnabledAfter(filter.getEnabledAfter()); // may be null
// after
if (filter.getEnabledAfter() != null) {
query.planItemInstanceLastEnabledAfter(filter.getEnabledAfter());
} Defensive patterns
Strategy: validation
Validate before calling
if (enabledAfter == null) {
throw new IllegalArgumentException("enabledAfter must be a non-null Date");
}
query.planItemInstanceLastEnabledAfter(enabledAfter); Type guard
boolean present(Date d) { return d != null; } Try / catch
try {
query.planItemInstanceLastEnabledAfter(enabledAfter);
} catch (FlowableIllegalArgumentException e) {
query = cmmnRuntimeService.createPlanItemInstanceQuery();
} Prevention
- Null-check every date filter before applying it
- Coalesce absent dates to defaults at the service boundary
- Prefer conditional chaining over null arguments
- Cover optional-filter paths in integration tests
When it happens
Trigger: Invoking planItemInstanceLastEnabledAfter(null) on a PlanItemInstanceQuery, e.g. when a lookup of the 'enabled after' timestamp returned null or a request field was absent.
Common situations: Optional filters wired directly from REST query params; null return from a utility that fetches reference dates; Spring @RequestParam defaults omitted; copy-paste refactors renaming variables but keeping null initializers.
Related errors
- activatedBefore is null
- completedBefore is null
- disabledAfter is null
- disabledBefore is null
- enabledBefore is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/25ffeff70e92e0bc.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java:428
}
@Override
public PlanItemInstanceQuery planItemInstanceLastEnabledBefore(Date enabledBefore) {
if (enabledBefore == null) {
throw new FlowableIllegalArgumentException("enabledBefore is null");
}
if (inOrStatement) {
this.currentOrQueryObject.lastEnabledBefore = enabledBefore;
} else {
this.lastEnabledBefore = enabledBefore;
}
return this;
}
@Override
public PlanItemInstanceQuery planItemInstanceLastEnabledAfter(Date enabledAfter) {
if (enabledAfter == null) {
throw new FlowableIllegalArgumentException("enabledAfter is null");
}
if (inOrStatement) {
this.currentOrQueryObject.lastEnabledAfter = enabledAfter;
} else {
this.lastEnabledAfter = enabledAfter;
}
return this;
}
@Override
public PlanItemInstanceQuery planItemInstanceLastDisabledBefore(Date disabledBefore) {
if (disabledBefore == null) {
throw new FlowableIllegalArgumentException("disabledBefore is null");
}
if (inOrStatement) {
this.currentOrQueryObject.lastDisabledBefore = disabledBefore;
} else {
this.lastDisabledBefore = disabledBefore;View on GitHub (pinned to d6d39ce1c6)