{"record":{"id":"a3ee4599d32e662c","repo":"flowable/flowable-engine","slug":"process-category-list-is-null","errorCode":null,"errorMessage":"Process category list is null","messagePattern":"Process category list is 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":619,"sourceCode":"            this.processDefinitionName = processDefinitionName;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery processDefinitionNameLike(String processDefinitionNameLike) {\n        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","sourceCodeStart":601,"sourceCodeEnd":637,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java#L601-L637","documentation":"HistoricTaskInstanceQueryImpl.processCategoryIn(Collection<String>) validates its input and throws FlowableIllegalArgumentException('Process category list is null') when the collection argument is null. The category IN predicate requires an actual list; the builder fails fast instead of producing broken SQL.","triggerScenarios":"Calling historicTaskInstanceQuery().processCategoryIn(null), usually when the categories collection originates from an uninitialized field or an API that returns null for 'no categories'.","commonSituations":"Dynamic dashboards/filters where the selected categories list was never initialized; configuration lookup returning null when no category filter is configured.","solutions":["Null-check before calling and skip the predicate when categories are absent.","Initialize the collection at declaration (new ArrayList<>()) so it is never null.","Normalize null at the data boundary to an empty list and branch on emptiness instead."],"exampleFix":"// before\nquery.processCategoryIn(config.getCategories()); // null when unconfigured\n\n// after\nList<String> cats = config.getCategories();\nif (cats != null && !cats.isEmpty()) {\n    query.processCategoryIn(cats);\n}","handlingStrategy":"type-guard","validationCode":"if (categories == null) { categories = Collections.emptyList(); }","typeGuard":"boolean isUsableCategoryList(Collection<String> c) { return c != null && !c.isEmpty(); }","tryCatchPattern":"try {\n    query.processCategoryIn(categories);\n} catch (FlowableIllegalArgumentException e) {\n    // fall back to query without category filter\n}","preventionTips":["Initialize category filter collections to empty lists, not null","Normalize configuration lookups so absent filters return empty lists","Wrap query building in a helper that null-checks all collection filters"],"tags":["query","null-argument","task-history","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"}