flowable/flowable-engine · error · ActivitiIllegalArgumentException

name is null

Error message

name is null

What it means

ActivitiIllegalArgumentException thrown by the private addVariable method of AbstractVariableQueryImpl when the variable name is null. Every variable query condition added via variableValueEquals/Like/IgnoreCase-style methods funnels through addVariable, which requires a non-null name to build a QueryVariableValue. Fail-fast validation before the query is executed.

Solutions

  1. Ensure the variable name constant/key exists and is non-null before building the query.
  2. Null-check the name variable and throw a descriptive application-level error naming the missing configuration key.
  3. Verify refactoring did not break a constant reference (e.g. renamed field constant now resolving to null).

Example fix

// before
String varName = config.get("priorityVar");
query.taskVariableValueEquals(varName, 5);
// after
String varName = config.get("priorityVar");
if (varName == null) {
    throw new IllegalStateException("config key priorityVar is required");
}
query.taskVariableValueEquals(varName, 5);
Defensive patterns

Strategy: validation

Validate before calling

Objects.requireNonNull(varName, "Variable name must not be null");
query.taskVariableValueEquals(varName, value);

Type guard

boolean isValidVarName(String n) { return n != null && !n.trim().isEmpty(); }

Try / catch

try {
    builder.addVariableCondition(name, value);
} catch (ActivitiIllegalArgumentException e) {
    throw new IllegalStateException("Bad query condition: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Calling any variable query method such as taskVariableValueEquals(null, value), variableValueLike(null, value), variableValueGreaterThan(null, v), etc., with a null variable name.

Common situations: The variable name comes from a constant map, properties file key, or external configuration that is missing, so getName()/config lookup returns null and is passed into the query builder.

Related errors


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

Appendix: source

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

    public T variableValueLikeIgnoreCase(String name, String value) {
        return variableValueLikeIgnoreCase(name, value, true);
    }

    @SuppressWarnings("unchecked")
    public T variableValueLike(String name, String value, boolean localScope) {
        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");
            }

View on GitHub (pinned to d6d39ce1c6)