flowable/flowable-engine · error · FlowableIllegalArgumentException

Invalid query usage: cannot set both taskNameInIgnoreCase…

Error message

Invalid query usage: cannot set both taskNameInIgnoreCase and nameLike

What it means

Thrown by TaskQuery.taskNameInIgnoreCase(Collection) when taskNameLike(String) was already set. A LIKE pattern and an ignore-case IN list are alternative, non-combinable name-matching strategies; the API forbids both so the generated SQL stays deterministic. The check runs before the query is stored or executed.

Solutions

  1. Choose one: remove taskNameLike(...) or taskNameInIgnoreCase(...)
  2. Remember taskNameInIgnoreCase already handles case, so it often replaces LIKE-style matching for list inputs
  3. Split into two queries and merge results in application code if both filters are truly needed

Example fix

// before
taskQuery.taskNameLike("Sign%")
         .taskNameInIgnoreCase(Arrays.asList("Sign Off", "Review"));
// after
taskQuery.taskNameInIgnoreCase(Arrays.asList("Sign Off", "Review"));
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try {
    taskService.createTaskQuery().taskNameInIgnoreCase(names).list();
} catch (FlowableIllegalArgumentException e) {
    // drop one criterion and rebuild
}

Prevention

When it happens

Trigger: taskQuery.taskNameLike("Sign%") then taskQuery.taskNameInIgnoreCase(names) on the same query or inside one or() block; triggers whenever nameLike is non-null at call time.

Common situations: Search screens offering both 'wildcard search' and 'pick from list'; layered filter composition (base query uses LIKE, enhancement adds IN); migrating from taskNameLike to taskNameInIgnoreCase without deleting the old call.

Related errors


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

Appendix: source

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

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

View on GitHub (pinned to d6d39ce1c6)