flowable/flowable-engine · error · FlowableIllegalArgumentException

after time is null

Error message

after time is null

What it means

Flowable throws this FlowableIllegalArgumentException when CaseInstanceQueryImpl.caseInstanceStartedAfter(Date) receives a null afterTime. The started-after filter is the lower bound of the start-time range; a null bound cannot be translated to SQL, so it is rejected eagerly.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java:556

    @Override
    public CaseInstanceQueryImpl caseInstanceStartedBefore(Date beforeTime) {
        if (beforeTime == null) {
            throw new FlowableIllegalArgumentException("before time is null");
        }

        if (inOrStatement) {
            this.currentOrQueryObject.startedBefore = beforeTime;
        } else {
            this.startedBefore = beforeTime;
        }
        return this;
    }

    @Override
    public CaseInstanceQueryImpl caseInstanceStartedAfter(Date afterTime) {
        if (afterTime == null) {
            throw new FlowableIllegalArgumentException("after time is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.startedAfter = afterTime;
        } else {
            this.startedAfter = afterTime;
        }
        return this;
    }

    @Override
    public CaseInstanceQueryImpl caseInstanceStartedBy(String userId) {
        if (userId == null) {
            throw new FlowableIllegalArgumentException("user id is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.startedBy = userId;
        } else {
            this.startedBy = userId;

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass a valid java.util.Date lower bound
  2. Omit the startedAfter call when no lower bound is needed
  3. Provide a sensible default (e.g. epoch or now minus retention window) when the input is absent

Example fix

// before
query.caseInstanceStartedAfter(sinceDate); // throws when sinceDate == null
// after
if (sinceDate != null) {
    query.caseInstanceStartedAfter(sinceDate);
}
Defensive patterns

Strategy: validation

Validate before calling

Date after = parseDate(afterStr);
if (after != null) {
    query.caseInstanceStartedAfter(after);
}

Type guard

boolean isValidBound(Date d) { return d != null; }

Try / catch

try {
    query.caseInstanceStartedAfter(after);
} catch (FlowableIllegalArgumentException e) {
    log.warn("Skipping started-after filter: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling caseInstanceQuery.caseInstanceStartedAfter(null) directly, or supplying a Date that was never initialized because parsing/lookup failed.

Common situations: Dashboard 'started since' filters left empty by users; REST query parameters mapped to null; computing a since-date from config with a missing key.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/e32464a3471c3144. Report an issue: GitHub.