flowable/flowable-engine · error · ActivitiIllegalArgumentException

Booleans and null cannot be used in 'greater than' condition

Error message

Booleans and null cannot be used in 'greater than' condition

What it means

ActivitiIllegalArgumentException thrown by addVariable when a null or Boolean value is combined with the GREATER_THAN operator. Null values and booleans only support EQUALS and NOT_EQUALS semantics because ordering comparisons on them are undefined in the variable-query model. The check runs at query-build time, before execution.

Solutions

  1. Restrict ordering conditions to numeric, date, or string values; handle booleans with EQUALS.
  2. Null-check the value and skip the condition when it is null.
  3. If the field became boolean, replace variableValueGreaterThan with variableValueEquals(name, true/false).

Example fix

// before
query.taskVariableGreaterThan("active", isActive);
// after
query.taskVariableValueEquals("active", isActive);
Defensive patterns

Strategy: type-guard

Validate before calling

if (value != null && !(value instanceof Boolean)) {
    query.taskVariableGreaterThan(name, value);
} else if (value instanceof Boolean) {
    query.taskVariableValueEquals(name, value);
}

Type guard

boolean isOrderable(Object v) { return v != null && !(v instanceof Boolean); }

Try / catch

try {
    query.taskVariableGreaterThan(name, value);
} catch (ActivitiIllegalArgumentException e) {
    log.warn("Cannot order-compare value {}: {}", value, e.getMessage());
}

Prevention

When it happens

Trigger: Calling variableValueGreaterThan(name, null), variableValueGreaterThan(name, someBoolean), or adding a GREATER_THAN condition whose value evaluates to Boolean/null, e.g. dynamic query builders branching on user-supplied filter values.

Common situations: Dynamic filter UIs or generic query wrappers map a null or boolean input to a 'greater than' predicate, or a type change (int flag became Boolean) silently routes boolean values into ordering operators.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/AbstractVariableQueryImpl.java:178

        addVariable(name, value, QueryOperator.LIKE, localScope);
        return (T) this;
    }

    @SuppressWarnings("unchecked")
    public T variableValueLikeIgnoreCase(String name, String value, boolean localScope) {
        addVariable(name, value, QueryOperator.LIKE_IGNORE_CASE, localScope);
        return (T) this;
    }

    private void addVariable(String name, Object value, QueryOperator operator, boolean localScope) {
        if (name == null) {
            throw new ActivitiIllegalArgumentException("name is null");
        }
        if (value == null || isBoolean(value)) {
            // Null-values and booleans can only be used in EQUALS and NOT_EQUALS
            switch (operator) {
                case GREATER_THAN:
                    throw new ActivitiIllegalArgumentException("Booleans and null cannot be used in 'greater than' condition");
                case LESS_THAN:
                    throw new ActivitiIllegalArgumentException("Booleans and null cannot be used in 'less than' condition");
                case GREATER_THAN_OR_EQUAL:
                    throw new ActivitiIllegalArgumentException("Booleans and null cannot be used in 'greater than or equal' condition");
                case LESS_THAN_OR_EQUAL:
                    throw new ActivitiIllegalArgumentException("Booleans and null cannot be used in 'less than or equal' condition");
            }

            if (operator == QueryOperator.EQUALS_IGNORE_CASE && !(value instanceof String)) {
                throw new ActivitiIllegalArgumentException("Only string values can be used with 'equals ignore case' condition");
            }

            if (operator == QueryOperator.NOT_EQUALS_IGNORE_CASE && !(value instanceof String)) {
                throw new ActivitiIllegalArgumentException("Only string values can be used with 'not equals ignore case' condition");
            }

            if ((operator == QueryOperator.LIKE || operator == QueryOperator.LIKE_IGNORE_CASE) && !(value instanceof String)) {
                throw new ActivitiIllegalArgumentException("Only string values can be used with 'like' condition");

View on GitHub (pinned to d6d39ce1c6)