flowable/flowable-engine · error · FlowableIllegalArgumentException

Invalid query usage: cannot set both taskNameInIgnoreCase…

Error message

Invalid query usage: cannot set both taskNameInIgnoreCase and nameLikeIgnoreCase

What it means

Thrown by TaskQuery.taskNameInIgnoreCase(Collection) when taskNameLikeIgnoreCase(String) was already set. Both are case-insensitive name matchers but one is a pattern and the other an exact IN list; Flowable treats them as mutually exclusive and throws FlowableIllegalArgumentException immediately.

Solutions

  1. Keep only one of taskNameLikeIgnoreCase(...) or taskNameInIgnoreCase(...) per query
  2. Prefer taskNameInIgnoreCase when the input is a finite list of names; keep the LIKE only for true prefix/pattern matching
  3. Guard the builder code so setting one clears/overrides the other instead of accumulating both

Example fix

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

Strategy: validation

Validate before calling

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

Try / catch

try {
    taskService.createTaskQuery().taskNameInIgnoreCase(names).list();
} catch (FlowableIllegalArgumentException e) {
    // choose one case-insensitive matcher and rebuild
}

Prevention

When it happens

Trigger: taskQuery.taskNameLikeIgnoreCase("audit%") then taskQuery.taskNameInIgnoreCase(names) on the same query (or same or() block); fires whenever nameLikeIgnoreCase is non-null at call time.

Common situations: Filter refactors from pattern search to list selection where the old call was left in place; configurable query pipelines where both settings can be enabled simultaneously; OR-query construction errors.

Related errors


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

Appendix: source

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

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

    @Override
    public TaskQueryImpl taskNameLike(String nameLike) {

View on GitHub (pinned to d6d39ce1c6)