flowable/flowable-engine · error · FlowableIllegalArgumentException

Task category list is empty

Error message

Task category list is empty

What it means

checkTaskCategoryList() rejects an empty category collection because an empty SQL IN () is invalid and matches nothing. Flowable throws FlowableIllegalArgumentException so the caller must handle the 'no categories selected' case explicitly.

Solutions

  1. Check isEmpty() before calling and return an empty result early
  2. Or skip the category filter if empty should mean 'all categories' (confirm intended semantics)
  3. Default to a sensible category set when none are provided

Example fix

// before
query.taskCategoryIn(selectedCategories); // may be empty
// after
if (selectedCategories.isEmpty()) {
    return Collections.emptyList();
}
query.taskCategoryIn(selectedCategories);
Defensive patterns

Strategy: validation

Validate before calling

if (categories == null || categories.isEmpty()) {
    return Collections.emptyList();
}
query.taskCategoryIn(categories);

Type guard

boolean nonEmpty(Collection<?> c) { return c != null && !c.isEmpty(); }

Try / catch

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

Prevention

When it happens

Trigger: Calling .taskCategoryIn(Collections.emptyList()) or a list reduced to zero items by prior filtering.

Common situations: UI filters where the user unselected all categories; config lists trimmed to empty after sanitization.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

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

View on GitHub (pinned to d6d39ce1c6)