{"record":{"id":"12c110017dae55d2","repo":"flowable/flowable-engine","slug":"none-of-the-given-task-names-can-be-null-12c110","errorCode":null,"errorMessage":"None of the given task names can be null","messagePattern":"None of the given task names can be null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java","lineNumber":260,"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(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 taskNameIn and name\");\n        }\n        if (nameLike != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both taskNameIn and nameLike\");\n        }\n        if (nameLikeIgnoreCase != null) {\n            throw new FlowableIllegalArgumentException(\"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":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L242-L278","documentation":"Flowable throws this FlowableIllegalArgumentException when any element of the collection passed to TaskQuery.taskNameIn is null. Null elements inside the IN list cannot be matched in SQL and would break the query, so each element is validated during construction. A companion check also rejects setting both taskNameIn and taskName on the same query.","triggerScenarios":"Calling taskNameIn(list) where list contains at least one null element - typically when the list was assembled from nullable inputs (e.g. map lookups, split strings, optional request fields).","commonSituations":"Collecting task names from heterogeneous sources where absent values became null list entries; deserialized JSON arrays containing nulls; building the list with Arrays.asList(a, b) where a variable was null.","solutions":["Filter out nulls before calling taskNameIn: names.removeIf(Objects::isNull) or stream().filter(Objects::nonNull).","Validate each element at the input boundary and reject requests containing null names.","Ensure the code producing the list maps absent values to defaults or skips them instead of adding null.","Also verify you are not setting both taskName and taskNameIn on the same query, which Flowable rejects next."],"exampleFix":"// before\nList<String> names = fetchNames(); // may contain nulls\nquery.taskNameIn(names); // throws\n// after\nList<String> names = fetchNames().stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (!names.isEmpty()) {\n    query.taskNameIn(names);\n}","handlingStrategy":"validation","validationCode":"List<String> safeNames = names == null ? Collections.emptyList()\n    : names.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (!safeNames.isEmpty()) {\n    query.taskNameIn(safeNames);\n}","typeGuard":"boolean allNonNull(Collection<String> c) { return c != null && c.stream().allMatch(Objects::nonNull); }","tryCatchPattern":"try {\n    query.taskNameIn(names);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().equals(\"None of the given task names can be null\")) {\n        throw new BadRequestException(\"task name list must not contain null elements\", e);\n    }\n    throw e;\n}","preventionTips":["Filter nulls from collections before IN-filter construction","Use Objects::nonNull in the stream that builds the name list","Reject null elements in request DTOs early (custom validator)","Remember the paired rule: never set both taskName and taskNameIn on one query"],"tags":["flowable","query-builder","null-element","collection","validation"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}