flowable/flowable-engine · error · FlowableIllegalArgumentException

State is null

Error message

State is null

What it means

Thrown by PlanItemInstanceQueryImpl.planItemInstanceState when the state filter is null. State must be one of the PlanItemInstanceState constants (e.g. 'active', 'enabled', 'available'). This method is also the backing implementation for the convenience methods (planItemInstanceStateActive, planItemInstanceStateEnabled, etc.), so those never hit this error — only direct calls with null do.

Solutions

  1. Pass a valid state constant, e.g. PlanItemInstanceState.ACTIVE.
  2. Use the typed convenience methods (planItemInstanceStateActive(), planItemInstanceStateEnabled(), ...) instead of hand-built strings.
  3. Null-check the resolved state and skip the filter if absent.

Example fix

// before
query.planItemInstanceState(stateParam); // stateParam may be null
// after
if (stateParam != null) {
    query.planItemInstanceState(stateParam);
}
// or, for known states:
query.planItemInstanceStateActive();
Defensive patterns

Strategy: validation

Validate before calling

if (state != null) {
    if (!PlanItemInstanceState.ALL_STATES.contains(state)) {
        throw new IllegalArgumentException("Unknown plan item instance state: " + state);
    }
    planItemInstanceQuery.planItemInstanceState(state);
}

Type guard

boolean isValidState(String s) {
    return s != null && PlanItemInstanceState.ALL_STATES.contains(s);
}

Try / catch

try {
    query.planItemInstanceState(state);
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().equals("State is null")) {
        // omit the state filter or reject the request
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling planItemInstanceState(null) directly, or passing a state variable resolved from config/DB/request that is null.

Common situations: Mapping an absent 'state' filter parameter into the query; passing a null from an enum lookup that failed (e.g. Enum.valueOf miss handled by returning null).

Related errors


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

Appendix: source

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

    }

    @Override
    public PlanItemInstanceQuery planItemInstanceName(String name) {
        if (name == null) {
            throw new FlowableIllegalArgumentException("Name is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.name = name;
        } else {
            this.name = name;
        }
        return this;
    }

    @Override
    public PlanItemInstanceQuery planItemInstanceState(String state) {
        if (state == null) {
            throw new FlowableIllegalArgumentException("State is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.state = state;
        } else {
            this.state = state;
        }
        return this;
    }
    
    @Override
    public PlanItemInstanceQuery planItemInstanceStateWaitingForRepetition() {
        return planItemInstanceState(PlanItemInstanceState.WAITING_FOR_REPETITION);
    }
    
    @Override
    public PlanItemInstanceQuery planItemInstanceStateActive() {
        return planItemInstanceState(PlanItemInstanceState.ACTIVE);
    }

View on GitHub (pinned to d6d39ce1c6)