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
taskNameInIgnoreCase also rejects combination with taskNameLikeIgnoreCase. If the case-insensitive LIKE filter is already set, the setter throws ActivitiIllegalArgumentException to prevent two conflicting name criteria.
Solutions
- Remove the taskNameLikeIgnoreCase call; taskNameInIgnoreCase already performs case-insensitive exact matching.
- If pattern semantics are truly needed, keep only taskNameLikeIgnoreCase and do not call the IN variant.
- Refactor query construction so name filters are set in exactly one place.
Example fix
// before
query.taskNameLikeIgnoreCase("review%");
query.taskNameInIgnoreCase(names);
// after
query.taskNameInIgnoreCase(names); Defensive patterns
Strategy: validation
Validate before calling
if (caseInsensitivePattern != null) {
query.taskNameLikeIgnoreCase(caseInsensitivePattern);
} else if (names != null && !names.isEmpty()) {
query.taskNameInIgnoreCase(names);
} Type guard
boolean canUseTaskNameInIgnoreCase(HistoricTaskInstanceQueryImpl q) { return q.getTaskNameLikeIgnoreCase() == null; } Try / catch
try {
query.taskNameInIgnoreCase(names);
} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {
// taskNameLikeIgnoreCase already set — rebuild with a single name filter
query = taskService.createHistoricTaskInstanceQuery().taskNameInIgnoreCase(names);
} Prevention
- Remember taskNameInIgnoreCase already ignores case — taskNameLikeIgnoreCase is unnecessary with it.
- After migrating to IN-list filters, remove legacy LIKE calls.
- Keep name filtering in a single code path.
When it happens
Trigger: Calling .taskNameInIgnoreCase(List<String>) after .taskNameLikeIgnoreCase("review%") on the same HistoricTaskInstanceQuery.
Common situations: Migration from LIKE-based filtering to IN-list filtering (e.g. after a version change exposing taskNameInIgnoreCase) where the old filter call was not removed.
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/4b17065789103c92.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java:423
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;
}
return this;
}
@Override
public HistoricTaskInstanceQuery taskNameLike(String taskNameLike) {View on GitHub (pinned to d6d39ce1c6)