{"record":{"id":"c1b19ff3efbab554","repo":"flowable/flowable-engine","slug":"invalid-query-usage-cannot-set-both-tasknameinign-c1b19f","errorCode":null,"errorMessage":"Invalid query usage: cannot set both taskNameInIgnoreCase and name","messagePattern":"Invalid query usage: cannot set both taskNameInIgnoreCase and name","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":417,"sourceCode":"        return this;\n    }\n\n    @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;","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java#L399-L435","documentation":"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.","triggerScenarios":"Calling .taskNameInIgnoreCase(List<String>) on a query where .taskName(\"x\") (or historic equivalents .taskName) was called earlier.","commonSituations":"Reusing a query object across request variants; combining a 'default name' with a dynamic list of names in one query.","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."],"exampleFix":"// before\nquery.taskName(\"review\");\nquery.taskNameInIgnoreCase(names);\n// after\nnames.add(\"review\");\nquery.taskNameInIgnoreCase(names);","handlingStrategy":"validation","validationCode":"// never set both; fold the single name into the list\nif (singleName != null) {\n    List<String> all = new ArrayList<>(namesOrDefault);\n    all.add(singleName);\n    query.taskNameInIgnoreCase(all);\n} else if (namesOrDefault != null && !namesOrDefault.isEmpty()) {\n    query.taskNameInIgnoreCase(namesOrDefault);\n}","typeGuard":"boolean canUseTaskNameInIgnoreCase(HistoricTaskInstanceQueryImpl q) { return q.getTaskName() == null; }","tryCatchPattern":"try {\n    query.taskNameInIgnoreCase(names);\n} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {\n    // taskName already set — rebuild query using only the in-list filter\n    query = taskService.createHistoricTaskInstanceQuery().taskNameInIgnoreCase(names);\n}","preventionTips":["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."],"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"}