{"record":{"id":"035af6ef686b3fc4","repo":"flowable/flowable-engine","slug":"none-of-the-given-process-categories-can-be-null","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":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":626,"sourceCode":"        if (inOrStatement) {\n            this.currentOrQueryObject.processDefinitionNameLike = processDefinitionNameLike;\n        } else {\n            this.processDefinitionNameLike = processDefinitionNameLike;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery processCategoryIn(Collection<String> processCategoryInList) {\n        if (processCategoryInList == null) {\n            throw new FlowableIllegalArgumentException(\"Process category list is null\");\n        }\n        if (processCategoryInList.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Process category list is empty\");\n        }\n        for (String processCategory : processCategoryInList) {\n            if (processCategory == null) {\n                throw new FlowableIllegalArgumentException(\"None of the given process categories can be null\");\n            }\n        }\n\n        if (inOrStatement) {\n            currentOrQueryObject.processCategoryInList = processCategoryInList;\n        } else {\n            this.processCategoryInList = processCategoryInList;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery processCategoryNotIn(Collection<String> processCategoryNotInList) {\n        if (processCategoryNotInList == null) {\n            throw new FlowableIllegalArgumentException(\"Process category list is null\");\n        }\n        if (processCategoryNotInList.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Process category list is empty\");","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java#L608-L644","documentation":"HistoricTaskInstanceQueryImpl.processCategoryIn(Collection) validates every entry in the passed collection and throws FlowableIllegalArgumentException when any element is null. Flowable requires concrete category strings because the values are bound directly into the query's IN clause. A null element cannot be matched against process categories, so the library rejects the whole list eagerly rather than producing a broken SQL query.","triggerScenarios":"Calling historicTaskInstanceQuery().processCategoryIn(categories) where the categories Collection is non-null and non-empty but contains at least one null element, e.g. a List built with Arrays.asList(\"a\", null).","commonSituations":"Building the category list from configuration files, database lookups, or upstream API responses where some entries are missing; nulls creeping in via Collections.nCopies or Arrays.asList with unfiltered variables.","solutions":["Filter nulls from the collection before passing it: categories.removeIf(Objects::isNull) or use a stream filter.","If filtering leaves the list empty, do not call processCategoryIn at all (the empty-list check would then fire).","Fix the upstream producer of the list so it never emits null category values."],"exampleFix":"// before\nquery.processCategoryIn(Arrays.asList(\"http://acme.org/finance\", null));\n// after\nList<String> cats = Stream.of(\"http://acme.org/finance\", maybeNull)\n    .filter(Objects::nonNull).collect(Collectors.toList());\nif (!cats.isEmpty()) {\n    query.processCategoryIn(cats);\n}","handlingStrategy":"validation","validationCode":"if (categories == null || categories.isEmpty() || categories.stream().anyMatch(Objects::isNull)) {\n    throw new IllegalArgumentException(\"processCategoryIn requires a non-empty list with no null entries\");\n}","typeGuard":"boolean isValidCategoryList(Collection<String> c) {\n    return c != null && !c.isEmpty() && c.stream().allMatch(Objects::nonNull);\n}","tryCatchPattern":"try {\n    query.processCategoryIn(categories);\n} catch (FlowableIllegalArgumentException e) {\n    logger.warn(\"Invalid process category list: {}\", e.getMessage());\n}","preventionTips":["Always construct collections with Stream.filter(Objects::nonNull) when sourcing from config or external data.","Prefer List.of(...) (null-hostile) over Arrays.asList(...) for fixed values.","Add a shared query-builder helper that centralizes list validation before Flowable calls."],"tags":["flowable","query-builder","null-argument","argument-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-18T11:17:12.947Z"}