{"record":{"id":"0543c29bb4884111","repo":"flowable/flowable-engine","slug":"invalid-query-usage-cannot-set-both-tasknameinign-0543c2","errorCode":null,"errorMessage":"Invalid query usage: cannot set both taskNameInIgnoreCase and nameLike","messagePattern":"Invalid query usage: cannot set both taskNameInIgnoreCase and nameLike","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":420,"sourceCode":"    @Override\n    public HistoricTaskInstanceQuery taskNameInIgnoreCase(List<String> taskNameList) {\n        if (taskNameList == null) {\n            throw new ActivitiIllegalArgumentException(\"Task name list is null\");\n        }\n        if (taskNameList.isEmpty()) {\n            throw new ActivitiIllegalArgumentException(\"Task name list is empty\");\n        }\n        for (String taskName : taskNameList) {\n            if (taskName == null) {\n                throw new ActivitiIllegalArgumentException(\"None of the given task names can be null\");\n            }\n        }\n\n        if (taskName != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set both taskNameInIgnoreCase and name\");\n        }\n        if (taskNameLike != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set both taskNameInIgnoreCase and nameLike\");\n        }\n        if (taskNameLikeIgnoreCase != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set both taskNameInIgnoreCase and nameLikeIgnoreCase\");\n        }\n\n        final int nameListSize = taskNameList.size();\n        final List<String> caseIgnoredTaskNameList = new ArrayList<>(nameListSize);\n        for (String taskName : taskNameList) {\n            caseIgnoredTaskNameList.add(taskName.toLowerCase());\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.taskNameListIgnoreCase = caseIgnoredTaskNameList;\n        } else {\n            this.taskNameListIgnoreCase = caseIgnoredTaskNameList;\n        }\n        return this;\n    }","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java#L402-L438","documentation":"taskNameInIgnoreCase is mutually exclusive with the pattern filter taskNameLike. Setting both makes the name criterion ambiguous, so the setter throws ActivitiIllegalArgumentException when taskNameLike is already non-null.","triggerScenarios":"Calling .taskNameInIgnoreCase(List<String>) after .taskNameLike(\"%rev%\") on the same query instance.","commonSituations":"Search UIs that offer both 'contains' text input and multi-select exact names; code that applies a LIKE fallback then also an IN list.","solutions":["Pick one strategy: remove the taskNameLike call, or keep only taskNameLike.","For case-insensitive matching of exact values, taskNameInIgnoreCase alone already covers the use case that taskNameLike was approximating.","Build the query from scratch per request rather than mutating a shared instance."],"exampleFix":"// before\nquery.taskNameLike(\"%rev%\");\nquery.taskNameInIgnoreCase(names);\n// after\nquery.taskNameInIgnoreCase(names); // drop the LIKE filter","handlingStrategy":"validation","validationCode":"if (pattern != null) {\n    query.taskNameLike(pattern);\n} else if (names != null && !names.isEmpty()) {\n    query.taskNameInIgnoreCase(names);\n}","typeGuard":"boolean canUseTaskNameInIgnoreCase(HistoricTaskInstanceQueryImpl q) { return q.getTaskNameLike() == null; }","tryCatchPattern":"try {\n    query.taskNameInIgnoreCase(names);\n} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {\n    // taskNameLike already set — pick one strategy and rebuild\n    throw new IllegalArgumentException(\"Use either taskNameLike or taskNameInIgnoreCase\", e);\n}","preventionTips":["Make pattern vs exact-list filtering an exclusive choice in your search API.","Rebuild queries when the user switches between 'contains' search and multi-select.","Test each filter combination you intend to support."],"tags":["flowable","query","invalid-usage"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}