flowable/flowable-engine · error · ActivitiIllegalArgumentException

None of the given task names can be null

Error message

None of the given task names can be null

What it means

Thrown by taskNameIn() when any element of the given name list is null. A null element cannot be included in the SQL IN comparison, so the engine validates every element and fails fast naming the constraint.

Solutions

  1. Filter nulls before the call: names.removeIf(Objects::isNull) or stream().filter(Objects::nonNull)
  2. Validate each element and reject the request upstream with a clear message
  3. After filtering, re-check the list is still non-empty to avoid the 'empty list' error

Example fix

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

Strategy: validation

Validate before calling

List<String> safeNames = names == null ? Collections.emptyList() : names.stream().filter(Objects::nonNull).collect(Collectors.toList());

Type guard

boolean hasNoNullElements(List<String> l) { return l != null && l.stream().allMatch(Objects::nonNull); }

Try / catch

try { query.taskNameIn(names); } catch (ActivitiIllegalArgumentException e) { throw new BadRequestException("name list contains null entries"); }

Prevention

When it happens

Trigger: Calling taskNameIn(Arrays.asList("a", null)) — e.g. a List built from a Map's values, a ResultSet, or user input where some entries are missing.

Common situations: Collecting names from optional fields into a list without filtering nulls; upstream data with holes; using Arrays.asList with varargs where one argument is null.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java:169

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

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

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

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

View on GitHub (pinned to d6d39ce1c6)