flowable/flowable-engine · error · FlowableIllegalArgumentException

after time is null

Error message

after time is null

What it means

ExecutionQueryImpl.startedAfter(Date) requires a non-null Date to filter process instances started after a given time. Flowable validates query parameters eagerly when building the query rather than at execution time, throwing FlowableIllegalArgumentException when null is passed. This prevents building a query with an undefined time criterion.

Solutions

  1. Guard the call: only invoke startedAfter(date) if date != null, otherwise skip the filter entirely
  2. Initialize the Date variable with a concrete value (e.g. new Date(0) for epoch) if a filter is always required
  3. Use the flowable query without the time criterion and filter results in application code if null was intended to mean 'no bound'

Example fix

// before
Date since = params.get("since");
runtimeService.createExecutionQuery().startedAfter(since);

// after
Date since = params.get("since");
ExecutionQuery query = runtimeService.createExecutionQuery();
if (since != null) {
    query.startedAfter(since);
}
Defensive patterns

Strategy: validation

Validate before calling

if (afterTime != null) {
    query.startedAfter(afterTime);
}

Type guard

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

Try / catch

try {
    query.startedAfter(afterTime);
} catch (FlowableIllegalArgumentException e) {
    if (!e.getMessage().contains("after time is null")) throw e;
    // rebuild query without the time filter
}

Prevention

When it happens

Trigger: Calling executionQuery.startedAfter(null) directly, or passing a Date variable that resolves to null (e.g. an uninitialized field, a missing map entry, or a method that returned null) into startedAfter while constructing an ExecutionQuery.

Common situations: Developers build dynamic date filters where the 'after' bound is optional; a null Optional-unwrapped date or a missing config value flows into startedAfter. Also common in code migrated from other APIs where null meant 'no filter'.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java:950

    @Override
    public ExecutionQuery startedBefore(Date beforeTime) {
        if (beforeTime == null) {
            throw new FlowableIllegalArgumentException("before time is null");
        }
        
        if (inOrStatement) {
            currentOrQueryObject.startedBefore = beforeTime;
        } else {
            this.startedBefore = beforeTime;
        }
        
        return this;
    }

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

        return this;
    }

    @Override
    public ExecutionQuery startedBy(String userId) {
        if (userId == null) {
            throw new FlowableIllegalArgumentException("user id is null");
        }
        
        if (inOrStatement) {

View on GitHub (pinned to d6d39ce1c6)