flowable/flowable-engine · error · FlowableIllegalArgumentException

activatedBefore is null

Error message

activatedBefore is null

What it means

planItemInstanceLastStartedBefore(Date) validates its startedBefore argument and throws FlowableIllegalArgumentException with message 'activatedBefore is null' when null is passed. Note the message predates a rename: the parameter is now startedBefore but the error text still says activatedBefore. Null filters are rejected in the builder so queries fail fast.

Solutions

  1. Pass a non-null Date to planItemInstanceLastStartedBefore.
  2. Skip the filter call when the date is absent.
  3. Coalesce null to a default date before building the query.
  4. If the message confuses you, confirm the actual parameter name (startedBefore) in the Flowable version you use, then apply a null check.

Example fix

// before
query.planItemInstanceLastStartedBefore(null); // throws 'activatedBefore is null'
// after
if (startedBefore != null) {
    query.planItemInstanceLastStartedBefore(startedBefore);
}
Defensive patterns

Strategy: validation

Validate before calling

if (startedBefore == null) {
    throw new IllegalArgumentException("startedBefore must be a non-null Date (error message may still say activatedBefore)");
}
query.planItemInstanceLastStartedBefore(startedBefore);

Type guard

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

Try / catch

try {
    query.planItemInstanceLastStartedBefore(startedBefore);
} catch (FlowableIllegalArgumentException e) {
    query = cmmnRuntimeService.createPlanItemInstanceQuery();
}

Prevention

When it happens

Trigger: Calling planItemInstanceLastStartedBefore(null) on a PlanItemInstanceQuery; also seen when code was migrated from the older activatedBefore-named API and the message text no longer matches the parameter.

Common situations: Migrations from older Flowable versions where the method was renamed from activated/started terminology; optional start-date filters left null by form handling; null from a scheduler's 'last run' lookup.

Related errors


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

Appendix: source

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

    }

    @Override
    public PlanItemInstanceQuery planItemInstanceLastDisabledAfter(Date disabledAfter) {
        if (disabledAfter == null) {
            throw new FlowableIllegalArgumentException("disabledAfter is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.lastDisabledAfter = disabledAfter;
        } else {
            this.lastDisabledAfter = disabledAfter;
        }
        return this;
    }

    @Override
    public PlanItemInstanceQuery planItemInstanceLastStartedBefore(Date startedBefore) {
        if (startedBefore == null) {
            throw new FlowableIllegalArgumentException("activatedBefore is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.lastStartedBefore = startedBefore;
        } else {
            this.lastStartedBefore = startedBefore;
        }
        return this;
    }

    @Override
    public PlanItemInstanceQuery planItemInstanceLastStartedAfter(Date startedAfter) {
        if (startedAfter == null) {
            throw new FlowableIllegalArgumentException("startedAfter is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.lastStartedAfter = startedAfter;
        } else {
            this.lastStartedAfter = startedAfter;

View on GitHub (pinned to d6d39ce1c6)