{"record":{"id":"ac7632cfad93bb65","repo":"flowable/flowable-engine","slug":"none-of-the-given-task-names-can-be-null-ac7632","errorCode":null,"errorMessage":"None of the given task names can be null","messagePattern":"None of the given task names can be null","errorType":"exception","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java","lineNumber":169,"sourceCode":"        if (orActive) {\n            currentOrQueryObject.name = name;\n        } else {\n            this.name = name;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQuery taskNameIn(List<String> nameList) {\n        if (nameList == null) {\n            throw new ActivitiIllegalArgumentException(\"Task name list is null\");\n        }\n        if (nameList.isEmpty()) {\n            throw new ActivitiIllegalArgumentException(\"Task name list is empty\");\n        }\n        for (String name : nameList) {\n            if (name == null) {\n                throw new ActivitiIllegalArgumentException(\"None of the given task names can be null\");\n            }\n        }\n\n        if (name != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set both taskNameIn and name\");\n        }\n        if (nameLike != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set both taskNameIn and nameLike\");\n        }\n        if (nameLikeIgnoreCase != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set both taskNameIn and nameLikeIgnoreCase\");\n        }\n\n        if (orActive) {\n            currentOrQueryObject.nameList = nameList;\n        } else {\n            this.nameList = nameList;\n        }","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java#L151-L187","documentation":"Thrown by taskNameIn() when any element of the given name list is null. A null element cannot be included in the SQL IN comparison, so the engine validates every element and fails fast naming the constraint.","triggerScenarios":"Calling taskNameIn(Arrays.asList(\"a\", null)) — e.g. a List built from a Map's values, a ResultSet, or user input where some entries are missing.","commonSituations":"Collecting names from optional fields into a list without filtering nulls; upstream data with holes; using Arrays.asList with varargs where one argument is null.","solutions":["Filter nulls before the call: names.removeIf(Objects::isNull) or stream().filter(Objects::nonNull)","Validate each element and reject the request upstream with a clear message","After filtering, re-check the list is still non-empty to avoid the 'empty list' error"],"exampleFix":"// before\nquery.taskNameIn(names);\n// after\nList<String> clean = names.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (!clean.isEmpty()) {\n    query.taskNameIn(clean);\n}","handlingStrategy":"validation","validationCode":"List<String> safeNames = names == null ? Collections.emptyList() : names.stream().filter(Objects::nonNull).collect(Collectors.toList());","typeGuard":"boolean hasNoNullElements(List<String> l) { return l != null && l.stream().allMatch(Objects::nonNull); }","tryCatchPattern":"try { query.taskNameIn(names); } catch (ActivitiIllegalArgumentException e) { throw new BadRequestException(\"name list contains null entries\"); }","preventionTips":["Use Objects::nonNull filters when building name lists from heterogeneous sources","Reject null elements at deserialization time (e.g. Jackson validation)","Prefer Optional-free explicit null checks when populating collections"],"tags":["java","query-builder","null-argument","collection","activiti"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T16:30:33.424Z"}