flowable/flowable-engine · error · ActivitiIllegalArgumentException

None of the given process categories can be null

Error message

None of the given process categories can be null

What it means

TaskQueryImpl.processCategoryIn(List) rejects a list containing any null element with ActivitiIllegalArgumentException. The engine validates each category entry before building the query because a null category cannot be matched in SQL. This is an eager argument-validation guard on the query builder API.

Solutions

  1. Filter nulls from the list before calling processCategoryIn: processCategoryInList.removeIf(Objects::isNull).
  2. If the filtered list becomes empty, do not apply the processCategoryIn filter at all.
  3. Log/inspect which input source produced the null entries and fix the upstream data.

Example fix

// before
taskQuery.processCategoryIn(categories); // categories = ["abc", null]
// after
List<String> valid = categories.stream().filter(Objects::nonNull).collect(Collectors.toList());
if (!valid.isEmpty()) { taskQuery.processCategoryIn(valid); }
Defensive patterns

Strategy: validation

Validate before calling

boolean ok = processCategoryInList != null && !processCategoryInList.isEmpty() && processCategoryInList.stream().noneMatch(Objects::null);
if (!ok) throw new IllegalArgumentException("processCategoryIn list must be non-empty with no null entries");

Type guard

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

Try / catch

try { query.processCategoryIn(categories); } catch (ActivitiIllegalArgumentException e) { log.warn("Invalid process category list", e); }

Prevention

When it happens

Trigger: Calling taskQuery.processCategoryIn(...) with a List<String> that contains at least one null element (e.g. a list built from a sparse Map or an array with unassigned slots).

Common situations: Assembling category names from configuration files or database rows where some entries are missing; mapping an array in Java where untouched slots stay null; deserializing a JSON array with absent values.

Related errors


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

Appendix: source

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

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

    @Override
    public TaskQuery processCategoryIn(List<String> processCategoryInList) {
        if (processCategoryInList == null) {
            throw new ActivitiIllegalArgumentException("Process category list is null");
        }
        if (processCategoryInList.isEmpty()) {
            throw new ActivitiIllegalArgumentException("Process category list is empty");
        }
        for (String processCategory : processCategoryInList) {
            if (processCategory == null) {
                throw new ActivitiIllegalArgumentException("None of the given process categories can be null");
            }
        }

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

    @Override
    public TaskQuery processCategoryNotIn(List<String> processCategoryNotInList) {
        if (processCategoryNotInList == null) {
            throw new ActivitiIllegalArgumentException("Process category list is null");
        }
        if (processCategoryNotInList.isEmpty()) {
            throw new ActivitiIllegalArgumentException("Process category list is empty");

View on GitHub (pinned to d6d39ce1c6)