flowable/flowable-engine · error · FlowableIllegalArgumentException

None of the given task categories can be null

Error message

None of the given task categories can be null

What it means

Collection-element validation in HistoricTaskInstanceQueryImpl.checkTaskCategoryList: the category list itself is fine, but at least one element inside it is null; such an element cannot be mapped to SQL, so the whole filter is rejected.

Solutions

  1. Filter null (and blank) entries from the collection before calling
  2. Fix the data source/parser that injects nulls
  3. If no valid categories remain, skip the filter entirely

Example fix

// before
query.taskCategoryIn(Arrays.asList("hr", null));
// after
List<String> cats = raw.stream().filter(c -> c != null && !c.isBlank()).collect(Collectors.toList());
if (!cats.isEmpty()) { query.taskCategoryIn(cats); }
Defensive patterns

Strategy: validation

Validate before calling

List<String> safe = categories.stream().filter(c -> c != null && !c.isBlank()).collect(Collectors.toList());
if (!safe.isEmpty()) { query.taskCategoryIn(safe); }

Type guard

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

Try / catch

try {
    query.taskCategoryIn(categories);
} catch (FlowableIllegalArgumentException e) {
    // sanitize and retry once
    query.taskCategoryIn(categories.stream().filter(Objects::nonNull).collect(Collectors.toList()));
}

Prevention

When it happens

Trigger: Calling taskCategoryIn(...) with a list containing null elements, e.g. from Arrays.asList("a", null) or sparse upstream data.

Common situations: Parsing comma-separated strings with trailing commas into lists containing nulls; aggregating category values from heterogeneous sources with missing entries.

Related errors


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

Appendix: source

Thrown at modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java:1848

        checkTaskCategoryList(taskCategoryNotInList);
        if (inOrStatement) {
            currentOrQueryObject.categoryNotInList = taskCategoryNotInList;
        } else {
            this.categoryNotInList = taskCategoryNotInList;
        }
        return this;
    }

    protected void checkTaskCategoryList(Collection<String> taskCategoryInList) {
        if (taskCategoryInList == null) {
            throw new FlowableIllegalArgumentException("Task category list is null");
        }
        if (taskCategoryInList.isEmpty()) {
            throw new FlowableIllegalArgumentException("Task category list is empty");
        }
        for (String processCategory : taskCategoryInList) {
            if (processCategory == null) {
                throw new FlowableIllegalArgumentException("None of the given task categories can be null");
            }
        }
    }

    @Override
    public HistoricTaskInstanceQuery taskWithoutCategory() {
        if (inOrStatement) {
            currentOrQueryObject.withoutCategory = true;
        } else {
            this.withoutCategory = true;
        }
        return this;
    }

    @Override
    public HistoricTaskInstanceQuery taskWithFormKey() {
        if (inOrStatement) {
            currentOrQueryObject.withFormKey = true;

View on GitHub (pinned to d6d39ce1c6)