flowable/flowable-engine · error · FlowableIllegalArgumentException

Task category list is null

Error message

Task category list is null

What it means

The internal helper checkTaskCategoryList() (used by taskCategoryIn) requires a non-null collection of task categories to build the IN clause. A null collection is rejected with FlowableIllegalArgumentException before any query runs.

Solutions

  1. Pass a non-null collection of category strings
  2. Null-check the source list and either omit the filter or default to the application's standard categories
  3. Make the producer return an empty list (then handle emptiness) instead of null

Example fix

// before
query.taskCategoryIn(categories); // categories may be null
// after
if (categories != null && !categories.isEmpty()) {
    query.taskCategoryIn(categories);
}
Defensive patterns

Strategy: validation

Validate before calling

if (categories == null) {
    throw new IllegalArgumentException("task categories must not be null");
}
query.taskCategoryIn(categories);

Type guard

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

Try / catch

try {
    tasks = taskService.createTaskQuery().taskCategoryIn(categories).list();
} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {
    log.warn("Invalid category filter: {}", e.getMessage());
    tasks = Collections.emptyList();
}

Prevention

When it happens

Trigger: Calling taskService.createTaskQuery().taskCategoryIn(null), typically when the category list is built dynamically from configuration or user selection.

Common situations: Category filter loaded from a missing config key; UI multi-select serialized with no field present.

Related errors


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

Appendix: source

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

        } else {
            this.categoryNotInList = taskCategoryNotInList;
        }
        return this;
    }

    @Override
    public TaskQuery taskWithoutCategory() {
        if (orActive) {
            currentOrQueryObject.withoutCategory = true;
        } else {
            this.withoutCategory = true;
        }
        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 category : taskCategoryInList) {
            if (category == null) {
                throw new FlowableIllegalArgumentException("None of the given task categories can be null");
            }
        }
    }

    @Override
    public TaskQuery taskWithFormKey() {
        if (orActive) {
            currentOrQueryObject.withFormKey = true;
        } else {
            this.withFormKey = true;
        }

View on GitHub (pinned to d6d39ce1c6)