{"record":{"id":"46db10af93ddeb60","repo":"flowable/flowable-engine","slug":"none-of-the-given-process-categories-can-be-null-46db10","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":400,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":301,"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(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\n    @Override\n    public HistoricTaskInstanceQuery 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":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java#L283-L319","documentation":"HistoricTaskInstanceQueryImpl.processCategoryIn() throws ActivitiIllegalArgumentException when any element of the category list is null. Since the list feeds an SQL IN clause, null entries are rejected. Remove nulls or fix the code that builds the list.","triggerScenarios":"Calling historicTaskInstanceQuery.processCategoryIn(Arrays.asList(\"http://example.com/hr\", null)).","commonSituations":"Reading category names from config files/DB rows where some entries are blank; mapping optional fields to list entries with nulls; JSON payloads containing null array items.","solutions":["Strip null entries: categories.removeIf(Objects::isNull) before calling.","Sanitize the config/source producing the categories so blanks become skips, not nulls.","Validate each category string (non-null, non-empty) when building the list."],"exampleFix":"// before\nquery.processCategoryIn(categories); // contains nulls\n\n// after\nList<String> safe = categories.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (!safe.isEmpty()) {\n    query.processCategoryIn(safe);\n}","handlingStrategy":"validation","validationCode":"List<String> safe = categories.stream().filter(c -> c != null && !c.trim().isEmpty()).collect(Collectors.toList());\nif (!safe.isEmpty()) { query.processCategoryIn(safe); }","typeGuard":"static boolean allNonNull(List<String> list) { return list != null && list.stream().allMatch(Objects::nonNull); }","tryCatchPattern":"try {\n    query.processCategoryIn(categories);\n} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {\n    log.error(\"processCategoryIn rejected: {}\", e.getMessage());\n    throw e; // programmer error, rethrow after logging\n}","preventionTips":["Sanitize config-sourced category lists (drop blank/null entries) at load time.","Prefer Optional-based assembly that skips missing values rather than inserting nulls.","Cover null-element cases in tests for list-valued query filters."],"tags":["java","activiti","query-validation","null-element"],"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"}