flowable/flowable-engine · error · ActivitiIllegalArgumentException

Booleans and null cannot be used in 'less than or equal'…

Error message

Booleans and null cannot be used in 'less than or equal' condition

What it means

ActivitiIllegalArgumentException thrown by addVariable when a null or Boolean value is used with the LESS_THAN_OR_EQUAL operator. As with other ordering operators, null/boolean values are restricted to EQUALS/NOT_EQUALS, so inclusive upper-bound conditions reject them eagerly.

Solutions

  1. Only add the condition when the upper bound is non-null and non-boolean.
  2. Use variableValueEquals for boolean values.
  3. Sanitize filter input before mapping it to query operators.

Example fix

// before
query.taskVariableLessThanOrEqual("score", upper);
// after
if (upper != null && !(upper instanceof Boolean)) {
    query.taskVariableLessThanOrEqual("score", upper);
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (upperBound != null && !(upperBound instanceof Boolean)) {
    query.taskVariableLessThanOrEqual(name, upperBound);
}

Type guard

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

Try / catch

try {
    query.taskVariableLessThanOrEqual(name, upperBound);
} catch (ActivitiIllegalArgumentException e) {
    log.warn("Skipping upper-bound filter: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling variableValueLessThanOrEqual(name, null) or variableValueLessThanOrEqual(name, aBoolean) on a query, or dynamic builders adding the operator with a null/Boolean operand.

Common situations: Range-filter UIs with empty upper-bound inputs, or type drift where a numeric variable is now stored as Boolean.

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/55bd226138d9963d. Report an issue: GitHub.

Appendix: source

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

        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");
            }
        }
        queryVariableValues.add(new QueryVariableValue(name, value, operator, localScope));
    }

    private boolean isBoolean(Object value) {

View on GitHub (pinned to d6d39ce1c6)