flowable/flowable-engine · error · FlowableIllegalArgumentException

Invalid query usage: cannot set both taskNameIn and…

Error message

Invalid query usage: cannot set both taskNameIn and nameLikeIgnoreCase

What it means

Thrown by TaskQuery.taskNameIn(Collection) when taskNameLikeIgnoreCase(String) was already set. IN-list matching and case-insensitive LIKE matching are mutually exclusive name criteria in the task query API; combining them would produce contradictory SQL. The library throws FlowableIllegalArgumentException eagerly, before any database call.

Solutions

  1. Use only one of taskNameLikeIgnoreCase(...) or taskNameIn(...) per query
  2. If case-insensitivity is what you need from the LIKE, consider taskNameInIgnoreCase(...) instead — but still only one criterion at a time
  3. Refactor into two queries and merge results in code if both filters are genuinely required

Example fix

// before
taskQuery.taskNameLikeIgnoreCase("review%")
         .taskNameIn(Arrays.asList("Review", "Audit"));
// after
taskQuery.taskNameInIgnoreCase(Arrays.asList("Review", "Audit"));
Defensive patterns

Strategy: validation

Validate before calling

if (nameLikeIgnoreCase != null && nameList != null) {
    throw new IllegalArgumentException("Use either taskNameLikeIgnoreCase or taskNameIn, not both");
}

Try / catch

try {
    taskService.createTaskQuery().taskNameIn(names).list();
} catch (FlowableIllegalArgumentException e) {
    // choose one criterion and retry the query build
}

Prevention

When it happens

Trigger: taskQuery.taskNameLikeIgnoreCase("review%") then taskQuery.taskNameIn(names) on the same query object (or within the same or() block); the check triggers whenever nameLikeIgnoreCase is non-null at taskNameIn() time.

Common situations: Dynamic filter UI offering both 'case-insensitive search' and 'select multiple names'; composing query conditions from two config sources; upgrading code where a new taskNameIn call was added to an existing case-insensitive LIKE query.

Related errors


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

Appendix: source

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

            throw new FlowableIllegalArgumentException("Task name list is null");
        }
        if (nameList.isEmpty()) {
            throw new FlowableIllegalArgumentException("Task name list is empty");
        }
        for (String name : nameList) {
            if (name == null) {
                throw new FlowableIllegalArgumentException("None of the given task names can be null");
            }
        }

        if (name != null) {
            throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and name");
        }
        if (nameLike != null) {
            throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and nameLike");
        }
        if (nameLikeIgnoreCase != null) {
            throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and nameLikeIgnoreCase");
        }

        if (orActive) {
            currentOrQueryObject.nameList = nameList;
        } else {
            this.nameList = nameList;
        }
        return this;
    }

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

View on GitHub (pinned to d6d39ce1c6)