{"record":{"id":"a8a2373b438f24e7","repo":"flowable/flowable-engine","slug":"none-of-the-given-process-categories-can-be-null-a8a237","errorCode":null,"errorMessage":"None of the given process categories can be null","messagePattern":"None of the given process categories can be null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java","lineNumber":1039,"sourceCode":"        if (orActive) {\n            currentOrQueryObject.processDefinitionNameLike = processDefinitionNameLike;\n        } else {\n            this.processDefinitionNameLike = processDefinitionNameLike;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQuery processCategoryIn(List<String> processCategoryInList) {\n        if (processCategoryInList == null) {\n            throw new ActivitiIllegalArgumentException(\"Process category list is null\");\n        }\n        if (processCategoryInList.isEmpty()) {\n            throw new ActivitiIllegalArgumentException(\"Process category list is empty\");\n        }\n        for (String processCategory : processCategoryInList) {\n            if (processCategory == null) {\n                throw new ActivitiIllegalArgumentException(\"None of the given process categories can be null\");\n            }\n        }\n\n        if (orActive) {\n            currentOrQueryObject.processCategoryInList = processCategoryInList;\n        } else {\n            this.processCategoryInList = processCategoryInList;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQuery processCategoryNotIn(List<String> processCategoryNotInList) {\n        if (processCategoryNotInList == null) {\n            throw new ActivitiIllegalArgumentException(\"Process category list is null\");\n        }\n        if (processCategoryNotInList.isEmpty()) {\n            throw new ActivitiIllegalArgumentException(\"Process category list is empty\");","sourceCodeStart":1021,"sourceCodeEnd":1057,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java#L1021-L1057","documentation":"TaskQueryImpl.processCategoryIn(List) rejects a list containing any null element with ActivitiIllegalArgumentException. The engine validates each category entry before building the query because a null category cannot be matched in SQL. This is an eager argument-validation guard on the query builder API.","triggerScenarios":"Calling taskQuery.processCategoryIn(...) with a List<String> that contains at least one null element (e.g. a list built from a sparse Map or an array with unassigned slots).","commonSituations":"Assembling category names from configuration files or database rows where some entries are missing; mapping an array in Java where untouched slots stay null; deserializing a JSON array with absent values.","solutions":["Filter nulls from the list before calling processCategoryIn: processCategoryInList.removeIf(Objects::isNull).","If the filtered list becomes empty, do not apply the processCategoryIn filter at all.","Log/inspect which input source produced the null entries and fix the upstream data."],"exampleFix":"// before\ntaskQuery.processCategoryIn(categories); // categories = [\"abc\", null]\n// after\nList<String> valid = categories.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (!valid.isEmpty()) { taskQuery.processCategoryIn(valid); }","handlingStrategy":"validation","validationCode":"boolean ok = processCategoryInList != null && !processCategoryInList.isEmpty() && processCategoryInList.stream().noneMatch(Objects::null);\nif (!ok) throw new IllegalArgumentException(\"processCategoryIn list must be non-empty with no null entries\");","typeGuard":"boolean hasNoNulls(List<String> l) { return l != null && l.stream().allMatch(Objects::nonNull); }","tryCatchPattern":"try { query.processCategoryIn(categories); } catch (ActivitiIllegalArgumentException e) { log.warn(\"Invalid process category list\", e); }","preventionTips":["Sanitize lists with Objects::nonNull filters before applying query filters","Never pass collections straight from unvalidated external input into query builders","Unit-test query builders with partially-null inputs"],"tags":["activiti","validation","null-argument","task-query"],"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"}