flowable/flowable-engine · error · ActivitiIllegalArgumentException

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

Error message

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

What it means

ActivitiIllegalArgumentException thrown by addVariable when a null or Boolean value is used with the LESS_THAN operator. The engine forbids ordering comparisons on null/boolean variable values since only EQUALS/NOT_EQUALS are meaningful for them. Validation occurs eagerly when the query condition is added.

Solutions

  1. Skip the condition when the value is null.
  2. Use variableValueEquals for boolean variables instead of range comparisons.
  3. Validate input types at the application boundary so booleans never reach LESS_THAN conditions.

Example fix

// before
if (filterValue != null) query.taskVariableLessThan("count", filterValue);
// after
if (filterValue != null && !(filterValue instanceof Boolean)) {
    query.taskVariableLessThan("count", filterValue);
}
Defensive patterns

Strategy: type-guard

Validate before calling

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

Type guard

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

Try / catch

try {
    query.taskVariableLessThan(name, value);
} catch (ActivitiIllegalArgumentException e) {
    log.warn("Skipping less-than filter: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling variableValueLessThan(name, null) or variableValueLessThan(name, aBoolean); also dynamic builders that choose LESS_THAN based on data whose value turns out to be Boolean or null.

Common situations: Generic search forms map 'value < X' filters with an empty (null) input, or a variable's Java type changed from numeric to Boolean and old range queries now fail.

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/2e0c9bf419383b40. Report an issue: GitHub.

Appendix: source

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

    }

    @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)