flowable/flowable-engine · error · FlowableIllegalArgumentException

Invalid query usage: cannot set both taskNameInIgnoreCase…

Error message

Invalid query usage: cannot set both taskNameInIgnoreCase and name

What it means

Thrown by TaskQuery.taskNameInIgnoreCase(Collection) when taskName(String) was already set on the query. Exact-name equality and a case-insensitive IN list are mutually exclusive name criteria; Flowable throws FlowableIllegalArgumentException at build time to keep the WHERE clause well-formed.

Solutions

  1. Keep only one name criterion: remove the taskName(...) call or the taskNameInIgnoreCase(...) call
  2. If case-insensitive matching of one name is desired, use taskNameInIgnoreCase(List.of(name)) alone instead of taskName
  3. Rebuild the query object instead of reusing a configured instance

Example fix

// before
taskQuery.taskName("Approve")
         .taskNameInIgnoreCase(Arrays.asList("Approve", "Sign Off"));
// after
taskQuery.taskNameInIgnoreCase(Arrays.asList("Approve", "Sign Off"));
Defensive patterns

Strategy: validation

Validate before calling

if (name != null && names != null) {
    throw new IllegalArgumentException("Use either taskName or taskNameInIgnoreCase, not both");
}

Try / catch

try {
    taskService.createTaskQuery().taskNameInIgnoreCase(names).list();
} catch (FlowableIllegalArgumentException e) {
    // rebuild query with a single name criterion
}

Prevention

When it happens

Trigger: taskQuery.taskName("Approve") followed by taskQuery.taskNameInIgnoreCase(names) on the same query (or same or() block); fires whenever the internal `name` field is non-null when the ignore-case IN variant is invoked.

Common situations: Composable filter builders where an earlier stage set an exact name and a later stage adds a bulk selection; query reuse without reset; branching logic that forgot one path already set taskName.

Related errors


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

Appendix: source

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

        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");
        }
        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 taskNameInIgnoreCase and name");
        }
        if (nameLike != null) {
            throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both taskNameInIgnoreCase and nameLike");
        }
        if (nameLikeIgnoreCase != null) {
            throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both taskNameInIgnoreCase and nameLikeIgnoreCase");
        }

        final int nameListSize = nameList.size();
        final Collection<String> caseIgnoredNameList = new ArrayList<>(nameListSize);
        for (String name : nameList) {
            caseIgnoredNameList.add(name.toLowerCase());
        }

        if (orActive) {
            this.currentOrQueryObject.nameListIgnoreCase = caseIgnoredNameList;
        } else {
            this.nameListIgnoreCase = caseIgnoredNameList;

View on GitHub (pinned to d6d39ce1c6)