flowable/flowable-engine · error · ActivitiIllegalArgumentException
Invalid query usage: cannot set both taskNameInIgnoreCase…
Error message
Invalid query usage: cannot set both taskNameInIgnoreCase and name
What it means
taskNameInIgnoreCase cannot be combined with the single exact-name filter taskName. When taskName is already set on the query, the setter throws ActivitiIllegalArgumentException because the two filters are mutually exclusive for the name column.
Solutions
- Include the single name inside the list and call only taskNameInIgnoreCase, or call only taskName.
- Clear/rebuild the query object instead of adding both filters.
- Branch in the caller based on how many names are available.
Example fix
// before
query.taskName("review");
query.taskNameInIgnoreCase(names);
// after
names.add("review");
query.taskNameInIgnoreCase(names); Defensive patterns
Strategy: validation
Validate before calling
// never set both; fold the single name into the list
if (singleName != null) {
List<String> all = new ArrayList<>(namesOrDefault);
all.add(singleName);
query.taskNameInIgnoreCase(all);
} else if (namesOrDefault != null && !namesOrDefault.isEmpty()) {
query.taskNameInIgnoreCase(namesOrDefault);
} Type guard
boolean canUseTaskNameInIgnoreCase(HistoricTaskInstanceQueryImpl q) { return q.getTaskName() == null; } Try / catch
try {
query.taskNameInIgnoreCase(names);
} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {
// taskName already set — rebuild query using only the in-list filter
query = taskService.createHistoricTaskInstanceQuery().taskNameInIgnoreCase(names);
} Prevention
- Merge single-name and multi-name inputs into one list before querying.
- Do not reuse query objects configured in earlier code paths.
- Centralize name-filter logic in one builder method.
When it happens
Trigger: Calling .taskNameInIgnoreCase(List<String>) on a query where .taskName("x") (or historic equivalents .taskName) was called earlier.
Common situations: Reusing a query object across request variants; combining a 'default name' with a dynamic list of names in one query.
Related errors
- Invalid query usage: cannot set both taskNameIn and taskName
- Invalid query usage: cannot set both taskNameIn and…
- Invalid query usage: cannot set both taskNameIn and…
- Invalid query usage: cannot set both taskNameInIgnoreCase…
- Invalid query usage: cannot set both taskNameInIgnoreCase…
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/c1b19ff3efbab554.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java:417
return this;
}
@Override
public HistoricTaskInstanceQuery taskNameInIgnoreCase(List<String> taskNameList) {
if (taskNameList == null) {
throw new ActivitiIllegalArgumentException("Task name list is null");
}
if (taskNameList.isEmpty()) {
throw new ActivitiIllegalArgumentException("Task name list is empty");
}
for (String taskName : taskNameList) {
if (taskName == null) {
throw new ActivitiIllegalArgumentException("None of the given task names can be null");
}
}
if (taskName != null) {
throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskNameInIgnoreCase and name");
}
if (taskNameLike != null) {
throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskNameInIgnoreCase and nameLike");
}
if (taskNameLikeIgnoreCase != null) {
throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskNameInIgnoreCase and nameLikeIgnoreCase");
}
final int nameListSize = taskNameList.size();
final List<String> caseIgnoredTaskNameList = new ArrayList<>(nameListSize);
for (String taskName : taskNameList) {
caseIgnoredTaskNameList.add(taskName.toLowerCase());
}
if (inOrStatement) {
this.currentOrQueryObject.taskNameListIgnoreCase = caseIgnoredTaskNameList;
} else {
this.taskNameListIgnoreCase = caseIgnoredTaskNameList;View on GitHub (pinned to d6d39ce1c6)