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
Activiti task queries allow only one name filter at a time. Once taskName(String) has set the exact `name` criterion, calling taskNameInIgnoreCase(...) would create conflicting conditions, so the engine throws ActivitiIllegalArgumentException at query build time.
Solutions
- Remove the taskName(...) call so only taskNameInIgnoreCase is applied
- Decide which filter wins in your API layer and reject requests that supply both before building the query
- Build a fresh TaskQuery instance per filter mode instead of mutating a shared one
Example fix
// before
taskQuery.taskName("review").taskNameInIgnoreCase(names);
// after
taskQuery.taskNameInIgnoreCase(names); // drop the exact-name filter Defensive patterns
Strategy: validation
Validate before calling
if (exactName != null && namesIn != null) {
throw new IllegalArgumentException("Provide either an exact task name or a name list, not both");
} Try / catch
try {
buildTaskQuery(criteria);
} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {
throw new InvalidSearchCriteriaException(e.getMessage());
} Prevention
- Enforce one-name-filter semantics in your search DTO validation
- Build a fresh TaskQuery per request instead of reusing/mutating one
- Centralize criteria-to-query mapping so conflicts are caught in one place
When it happens
Trigger: Chaining taskQuery.taskName("foo").taskNameInIgnoreCase(list) (or calling taskNameInIgnoreCase when orQuery `name` is set) on the same TaskQuery object.
Common situations: Composing query criteria dynamically from a search DTO where both exactName and nameIn fields were provided by the caller; copy-paste reuse of a base query object that already had taskName set.
Related errors
- Invalid query usage: cannot set both taskNameInIgnoreCase…
- Invalid query usage: cannot set both taskNameInIgnoreCase…
- Invalid query usage: cannot set both candidateGroupIn and…
- Invalid query usage: cannot set both candidateGroup and…
- Invalid query usage: cannot set both candidateGroup and…
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/576311871fafe955.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java:206
return this;
}
@Override
public TaskQuery taskNameInIgnoreCase(List<String> nameList) {
if (nameList == null) {
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;View on GitHub (pinned to d6d39ce1c6)