{"record":{"id":"c9e4812dcb21dc3a","repo":"flowable/flowable-engine","slug":"invalid-query-usage-cannot-set-both-tasknameinign-c9e481","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":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java","lineNumber":297,"sourceCode":"        return this;\n    }\n\n    @Override\n    public TaskQuery taskNameInIgnoreCase(Collection<String> nameList) {\n        if (nameList == null) {\n            throw new FlowableIllegalArgumentException(\"Task name list is null\");\n        }\n        if (nameList.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Task name list is empty\");\n        }\n        for (String name : nameList) {\n            if (name == null) {\n                throw new FlowableIllegalArgumentException(\"None of the given task names can be null\");\n            }\n        }\n\n        if (name != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both taskNameInIgnoreCase and name\");\n        }\n        if (nameLike != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both taskNameInIgnoreCase and nameLike\");\n        }\n        if (nameLikeIgnoreCase != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both taskNameInIgnoreCase and nameLikeIgnoreCase\");\n        }\n\n        final int nameListSize = nameList.size();\n        final Collection<String> caseIgnoredNameList = new ArrayList<>(nameListSize);\n        for (String name : nameList) {\n            caseIgnoredNameList.add(name.toLowerCase());\n        }\n\n        if (orActive) {\n            this.currentOrQueryObject.nameListIgnoreCase = caseIgnoredNameList;\n        } else {\n            this.nameListIgnoreCase = caseIgnoredNameList;","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L279-L315","documentation":"Thrown by TaskQuery.taskNameInIgnoreCase(Collection) when taskName(String) was already set on the query. Exact-name equality and a case-insensitive IN list are mutually exclusive name criteria; Flowable throws FlowableIllegalArgumentException at build time to keep the WHERE clause well-formed.","triggerScenarios":"taskQuery.taskName(\"Approve\") followed by taskQuery.taskNameInIgnoreCase(names) on the same query (or same or() block); fires whenever the internal `name` field is non-null when the ignore-case IN variant is invoked.","commonSituations":"Composable filter builders where an earlier stage set an exact name and a later stage adds a bulk selection; query reuse without reset; branching logic that forgot one path already set taskName.","solutions":["Keep only one name criterion: remove the taskName(...) call or the taskNameInIgnoreCase(...) call","If case-insensitive matching of one name is desired, use taskNameInIgnoreCase(List.of(name)) alone instead of taskName","Rebuild the query object instead of reusing a configured instance"],"exampleFix":"// before\ntaskQuery.taskName(\"Approve\")\n         .taskNameInIgnoreCase(Arrays.asList(\"Approve\", \"Sign Off\"));\n// after\ntaskQuery.taskNameInIgnoreCase(Arrays.asList(\"Approve\", \"Sign Off\"));","handlingStrategy":"validation","validationCode":"if (name != null && names != null) {\n    throw new IllegalArgumentException(\"Use either taskName or taskNameInIgnoreCase, not both\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    taskService.createTaskQuery().taskNameInIgnoreCase(names).list();\n} catch (FlowableIllegalArgumentException e) {\n    // rebuild query with a single name criterion\n}","preventionTips":["Only one name criterion per query or or() block","Use taskNameInIgnoreCase(List.of(oneName)) as a case-insensitive replacement for taskName","Build queries in one place to avoid conflicting setters from different code paths"],"tags":["flowable","query-usage","task-query","mutually-exclusive"],"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"}