flowable/flowable-engine · error · FlowableIllegalArgumentException

None of the given task names can be null

Error message

None of the given task names can be null

What it means

Flowable throws this FlowableIllegalArgumentException when any element of the collection passed to TaskQuery.taskNameIn is null. Null elements inside the IN list cannot be matched in SQL and would break the query, so each element is validated during construction. A companion check also rejects setting both taskNameIn and taskName on the same query.

Source

Thrown at modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java:260

        if (orActive) {
            currentOrQueryObject.name = name;
        } else {
            this.name = name;
        }
        return this;
    }

    @Override
    public TaskQuery taskNameIn(Collection<String> nameList) {
        if (nameList == null) {
            throw new FlowableIllegalArgumentException("Task name list is null");
        }
        if (nameList.isEmpty()) {
            throw new FlowableIllegalArgumentException("Task name list is empty");
        }
        for (String name : nameList) {
            if (name == null) {
                throw new FlowableIllegalArgumentException("None of the given task names can be null");
            }
        }

        if (name != null) {
            throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and name");
        }
        if (nameLike != null) {
            throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and nameLike");
        }
        if (nameLikeIgnoreCase != null) {
            throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and nameLikeIgnoreCase");
        }

        if (orActive) {
            currentOrQueryObject.nameList = nameList;
        } else {
            this.nameList = nameList;
        }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Filter out nulls before calling taskNameIn: names.removeIf(Objects::isNull) or stream().filter(Objects::nonNull).
  2. Validate each element at the input boundary and reject requests containing null names.
  3. Ensure the code producing the list maps absent values to defaults or skips them instead of adding null.
  4. Also verify you are not setting both taskName and taskNameIn on the same query, which Flowable rejects next.

Example fix

// before
List<String> names = fetchNames(); // may contain nulls
query.taskNameIn(names); // throws
// after
List<String> names = fetchNames().stream().filter(Objects::nonNull).collect(Collectors.toList());
if (!names.isEmpty()) {
    query.taskNameIn(names);
}
Defensive patterns

Strategy: validation

Validate before calling

List<String> safeNames = names == null ? Collections.emptyList()
    : names.stream().filter(Objects::nonNull).collect(Collectors.toList());
if (!safeNames.isEmpty()) {
    query.taskNameIn(safeNames);
}

Type guard

boolean allNonNull(Collection<String> c) { return c != null && c.stream().allMatch(Objects::nonNull); }

Try / catch

try {
    query.taskNameIn(names);
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().equals("None of the given task names can be null")) {
        throw new BadRequestException("task name list must not contain null elements", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling taskNameIn(list) where list contains at least one null element - typically when the list was assembled from nullable inputs (e.g. map lookups, split strings, optional request fields).

Common situations: Collecting task names from heterogeneous sources where absent values became null list entries; deserialized JSON arrays containing nulls; building the list with Arrays.asList(a, b) where a variable was null.

Related errors


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