flowable/flowable-engine · error · ActivitiIllegalArgumentException

Invalid query usage: cannot set both taskNameInIgnoreCase…

Error message

Invalid query usage: cannot set both taskNameInIgnoreCase and nameLikeIgnoreCase

What it means

taskNameLikeIgnoreCase(String) and taskNameInIgnoreCase(...) are both case-insensitive name filters and are mutually exclusive. When taskNameInIgnoreCase finds nameLikeIgnoreCase already set it throws ActivitiIllegalArgumentException rather than producing an ambiguous query.

Solutions

  1. Remove the taskNameLikeIgnoreCase(...) call and keep only taskNameInIgnoreCase
  2. Normalize your search criteria to a single name-filter mode before constructing the query
  3. If both semantics are needed, issue two separate queries and merge results

Example fix

// before
taskQuery.taskNameLikeIgnoreCase("%review%").taskNameInIgnoreCase(names);
// after
taskQuery.taskNameInIgnoreCase(names);
Defensive patterns

Strategy: validation

Validate before calling

if (nameLikeIgnoreCase != null && namesIn != null) {
    throw new IllegalArgumentException("Choose either case-insensitive name-like or name-in filtering, not both");
}

Try / catch

try {
    query.taskNameLikeIgnoreCase(pattern);
    query.taskNameInIgnoreCase(names);
} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {
    // keep only one case-insensitive filter and rebuild
}

Prevention

When it happens

Trigger: Chaining taskQuery.taskNameLikeIgnoreCase("%review%").taskNameInIgnoreCase(list), or vice versa on the same query object.

Common situations: UI search forms exposing multiple case-insensitive name options where the builder applies all provided values; refactors that swapped one ignore-case filter for the other without removing the first call.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java:212

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

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

        final int nameListSize = nameList.size();
        final List<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)