flowable/flowable-engine · error · FlowableIllegalArgumentException

None of the given process categories can be null

Error message

None of the given process categories can be null

What it means

HistoricTaskInstanceQueryImpl.processCategoryIn(Collection) validates every entry in the passed collection and throws FlowableIllegalArgumentException when any element is null. Flowable requires concrete category strings because the values are bound directly into the query's IN clause. A null element cannot be matched against process categories, so the library rejects the whole list eagerly rather than producing a broken SQL query.

Solutions

  1. Filter nulls from the collection before passing it: categories.removeIf(Objects::isNull) or use a stream filter.
  2. If filtering leaves the list empty, do not call processCategoryIn at all (the empty-list check would then fire).
  3. Fix the upstream producer of the list so it never emits null category values.

Example fix

// before
query.processCategoryIn(Arrays.asList("http://acme.org/finance", null));
// after
List<String> cats = Stream.of("http://acme.org/finance", maybeNull)
    .filter(Objects::nonNull).collect(Collectors.toList());
if (!cats.isEmpty()) {
    query.processCategoryIn(cats);
}
Defensive patterns

Strategy: validation

Validate before calling

if (categories == null || categories.isEmpty() || categories.stream().anyMatch(Objects::isNull)) {
    throw new IllegalArgumentException("processCategoryIn requires a non-empty list with no null entries");
}

Type guard

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

Try / catch

try {
    query.processCategoryIn(categories);
} catch (FlowableIllegalArgumentException e) {
    logger.warn("Invalid process category list: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling historicTaskInstanceQuery().processCategoryIn(categories) where the categories Collection is non-null and non-empty but contains at least one null element, e.g. a List built with Arrays.asList("a", null).

Common situations: Building the category list from configuration files, database lookups, or upstream API responses where some entries are missing; nulls creeping in via Collections.nCopies or Arrays.asList with unfiltered variables.

Related errors


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

Appendix: source

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

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

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

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

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

View on GitHub (pinned to d6d39ce1c6)