flowable/flowable-engine · error · ActivitiIllegalArgumentException
Invalid query usage: cannot set both taskNameIn and…
Error message
Invalid query usage: cannot set both taskNameIn and taskNameLike
What it means
taskNameIn conflicts with the LIKE-based filter taskNameLike. The taskNameIn setter rejects queries where taskNameLike was already set, since an exact IN list and a LIKE pattern cannot be combined for the same column in this query API.
Solutions
- Remove the .taskNameLike(...) call before calling taskNameIn, or use only taskNameLike.
- Use taskNameInIgnoreCase instead if case-insensitive matching of the list was the intent behind taskNameLike.
- Create a new query object instead of reusing one configured with taskNameLike.
Example fix
// before
query.taskNameLike("%review%");
query.taskNameIn(names);
// after
query.taskNameInIgnoreCase(names); // or drop the like filter
query.taskNameIn(names); Defensive patterns
Strategy: validation
Validate before calling
if (names != null && !names.isEmpty()) {
// choose ONE: like-pattern OR in-list
if (pattern != null) {
query.taskNameLike(pattern);
} else {
query.taskNameIn(names);
}
} Type guard
boolean canUseTaskNameIn(HistoricTaskInstanceQueryImpl q) { return q.getTaskNameLike() == null; } Try / catch
try {
query.taskNameIn(names);
} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {
// taskNameLike already set — drop it or use taskNameInIgnoreCase
throw new IllegalArgumentException("Choose either taskNameLike or taskNameIn", e);
} Prevention
- Decide per request whether filtering is exact-list or pattern-based, never both.
- Document that taskNameLike and taskName*In* are exclusive on the name column.
- Add a unit test covering each invalid combination.
When it happens
Trigger: Calling .taskNameIn(List<String>) on a HistoricTaskInstanceQuery on which .taskNameLike("%review%") was previously called.
Common situations: Dynamic query builders that add a pattern filter when the user types partial text, then also apply an IN list from a multi-select UI.
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 taskNameInIgnoreCase…
- 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/fa64d474e7d4fffc.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java:388
this.taskName = taskName;
}
return this;
}
@Override
public HistoricTaskInstanceQuery taskNameIn(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");
}
if (taskName != null) {
throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and taskName");
}
if (taskNameLike != null) {
throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and taskNameLike");
}
if (taskNameLikeIgnoreCase != null) {
throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskNameIn and taskNameLikeIgnoreCase");
}
if (inOrStatement) {
currentOrQueryObject.taskNameList = taskNameList;
} else {
this.taskNameList = taskNameList;
}
return this;
}
@Override
public HistoricTaskInstanceQuery taskNameInIgnoreCase(List<String> taskNameList) {
if (taskNameList == null) {
throw new ActivitiIllegalArgumentException("Task name list is null");
}View on GitHub (pinned to d6d39ce1c6)