flowable/flowable-engine · error · FlowableIllegalArgumentException

Task name list is empty

Error message

Task name list is empty

What it means

HistoricTaskInstanceQueryImpl.taskNameIn(Collection) throws FlowableIllegalArgumentException when the collection is non-null but empty. An empty IN list over task names would be invalid SQL or a no-op filter, so Flowable requires at least one name. Call the method only with a populated list.

Solutions

  1. Skip the call when the list is empty: only invoke taskNameIn if !names.isEmpty().
  2. Populate the collection with the intended task names before building the query.
  3. Fall back to an unfiltered (or differently filtered) query when no names are available.

Example fix

// before
query.taskNameIn(selectedNames); // empty
// after
if (selectedNames != null && !selectedNames.isEmpty()) {
    query.taskNameIn(selectedNames);
}
Defensive patterns

Strategy: validation

Validate before calling

if (taskNameList != null && taskNameList.isEmpty()) {
    // skip taskNameIn or fall back to another filter
}

Type guard

boolean hasNames(Collection<String> names) {
    return names != null && !names.isEmpty();
}

Try / catch

try {
    query.taskNameIn(names);
} catch (FlowableIllegalArgumentException e) {
    logger.warn("Empty task name list: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling historicTaskInstanceQuery().taskNameIn(new ArrayList<>()) or with a collection whose entries were all removed/filtered before query construction.

Common situations: Empty user selection in a UI passed straight to the query; configuration of included task names present but blank; deserialized empty JSON array.

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/7db29b86b0d2e6a6. Report an issue: GitHub.

Appendix: source

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

    }

    @Override
    public HistoricTaskInstanceQuery taskName(String taskName) {
        if (inOrStatement) {
            this.currentOrQueryObject.taskName = taskName;
        } else {
            this.taskName = taskName;
        }
        return this;
    }

    @Override
    public HistoricTaskInstanceQuery taskNameIn(Collection<String> taskNameList) {
        if (taskNameList == null) {
            throw new FlowableIllegalArgumentException("Task name list is null");
        }
        if (taskNameList.isEmpty()) {
            throw new FlowableIllegalArgumentException("Task name list is empty");
        }

        if (taskName != null) {
            throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and taskName");
        }
        if (taskNameLike != null) {
            throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and taskNameLike");
        }
        if (taskNameLikeIgnoreCase != null) {
            throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and taskNameLikeIgnoreCase");
        }

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

View on GitHub (pinned to d6d39ce1c6)