{"record":{"id":"8074573674bea134","repo":"flowable/flowable-engine","slug":"process-category-list-is-null-807457","errorCode":null,"errorMessage":"Process category list is null","messagePattern":"Process category list is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":294,"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(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 (inOrStatement) {\n            currentOrQueryObject.processCategoryInList = processCategoryInList;\n        } else {\n            this.processCategoryInList = processCategoryInList;\n        }\n        return this;\n    }\n","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java#L276-L312","documentation":"HistoricTaskInstanceQueryImpl.processCategoryIn() throws ActivitiIllegalArgumentException when the process category list is null. A null list is treated as a programming error rather than 'no filter'; pass an explicit list of category keys or omit the call. Categories correspond to process definition category values (e.g. from the BPMN targetNamespace mapping).","triggerScenarios":"Calling historicTaskInstanceQuery.processCategoryIn(null).","commonSituations":"Passing a variable that was never initialized; a lookup method returning null instead of an empty list; conditional query-building code that forwards a null unconditionally.","solutions":["Pass a concrete non-null list of category strings to processCategoryIn.","Only call processCategoryIn when the list is available: wrap in a null check.","Fix the producing code to return an empty list instead of null (though an empty list triggers its own error, so treat 'no filter' as skip-the-call)."],"exampleFix":"// before\nquery.processCategoryIn(categories); // categories may be null\n\n// after\nif (categories != null) {\n    query.processCategoryIn(categories);\n}","handlingStrategy":"validation","validationCode":"if (processCategoryInList == null || processCategoryInList.isEmpty()) { throw new IllegalArgumentException(\"processCategoryInList must be non-null and non-empty\"); }","typeGuard":"static boolean validCategoryList(List<String> list) { return list != null && !list.isEmpty() && list.stream().allMatch(Objects::nonNull); }","tryCatchPattern":"try {\n    query.processCategoryIn(categories);\n} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {\n    log.warn(\"Skipping category filter: {}\", e.getMessage());\n}","preventionTips":["Treat 'no filter' as skipping the method call, never passing null or empty.","Centralize Activiti query construction in a builder that applies filters conditionally.","Initialize category lists from config with explicit defaults."],"tags":["java","activiti","query-validation","null-argument"],"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"}