{"record":{"id":"986334e5f594dfdb","repo":"flowable/flowable-engine","slug":"none-of-the-given-task-categories-can-be-null-986334","errorCode":null,"errorMessage":"None of the given task categories can be null","messagePattern":"None of the given task categories can be null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java","lineNumber":1174,"sourceCode":"    public TaskQuery taskWithoutCategory() {\n        if (orActive) {\n            currentOrQueryObject.withoutCategory = true;\n        } else {\n            this.withoutCategory = true;\n        }\n        return this;\n    }\n\n    protected void checkTaskCategoryList(Collection<String> taskCategoryInList) {\n        if (taskCategoryInList == null) {\n            throw new FlowableIllegalArgumentException(\"Task category list is null\");\n        }\n        if (taskCategoryInList.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Task category list is empty\");\n        }\n        for (String category : taskCategoryInList) {\n            if (category == null) {\n                throw new FlowableIllegalArgumentException(\"None of the given task categories can be null\");\n            }\n        }\n    }\n\n    @Override\n    public TaskQuery taskWithFormKey() {\n        if (orActive) {\n            currentOrQueryObject.withFormKey = true;\n        } else {\n            this.withFormKey = true;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQuery taskFormKey(String formKey) {\n        if (formKey == null) {\n            throw new FlowableIllegalArgumentException(\"Task formKey is null\");","sourceCodeStart":1156,"sourceCodeEnd":1192,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L1156-L1192","documentation":"checkTaskCategoryList() iterates the category collection and rejects any null element, because a null category in the IN list would yield an invalid SQL predicate. Flowable throws FlowableIllegalArgumentException when one is found.","triggerScenarios":"Calling .taskCategoryIn(list) where the list contains null entries, e.g. Arrays.asList(\"orders\", null) or a Map-derived list with missing keys.","commonSituations":"Category lists assembled from optional lookups; CSV/config parsing that keeps empty slots as null.","solutions":["Filter nulls first: list.stream().filter(Objects::nonNull).collect(toList())","Fix the producer/parser to skip empty entries","Re-check for emptiness after filtering to avoid the empty-list error"],"exampleFix":"// before\nquery.taskCategoryIn(categories); // may contain nulls\n// after\nList<String> clean = categories.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (!clean.isEmpty()) {\n    query.taskCategoryIn(clean);\n}","handlingStrategy":"validation","validationCode":"List<String> clean = categories == null\n    ? Collections.emptyList()\n    : categories.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (clean.isEmpty()) { return Collections.emptyList(); }\nquery.taskCategoryIn(clean);","typeGuard":"boolean hasNoNullCategories(Collection<String> c) { return c != null && c.stream().allMatch(Objects::nonNull); }","tryCatchPattern":"try {\n    tasks = taskService.createTaskQuery().taskCategoryIn(categories).list();\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    log.warn(\"Null element in category list: {}\", e.getMessage());\n    tasks = Collections.emptyList();\n}","preventionTips":["Sanitize category input (split/trim/filter null-or-blank) before querying","Fix parsers that keep empty slots as null","Re-check emptiness after filtering"],"tags":["flowable","task-query","null-argument","collection"],"backgroundTag":"null-argument","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"}