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

checkTaskCategoryList() iterates the category collection and rejects any null element, because a null category in the IN list would yield an invalid SQL predicate. Flowable throws FlowableIllegalArgumentException when one is found.

Solutions

  1. Filter nulls first: list.stream().filter(Objects::nonNull).collect(toList())
  2. Fix the producer/parser to skip empty entries
  3. Re-check for emptiness after filtering to avoid the empty-list error

Example fix

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

Strategy: validation

Validate before calling

List<String> clean = categories == null
    ? Collections.emptyList()
    : categories.stream().filter(Objects::nonNull).collect(Collectors.toList());
if (clean.isEmpty()) { return Collections.emptyList(); }
query.taskCategoryIn(clean);

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Calling .taskCategoryIn(list) where the list contains null entries, e.g. Arrays.asList("orders", null) or a Map-derived list with missing keys.

Common situations: Category lists assembled from optional lookups; CSV/config parsing that keeps empty slots as null.

Related errors


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

Appendix: source

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

    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;
        }
        return this;
    }

    @Override
    public TaskQuery taskFormKey(String formKey) {
        if (formKey == null) {
            throw new FlowableIllegalArgumentException("Task formKey is null");

View on GitHub (pinned to d6d39ce1c6)