{"record":{"id":"09c1acc0139c9d1f","repo":"flowable/flowable-engine","slug":"process-category-list-is-empty","errorCode":null,"errorMessage":"Process category list is empty","messagePattern":"Process category list is empty","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":622,"sourceCode":"    }\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\n    @Override\n    public HistoricTaskInstanceQuery processCategoryNotIn(Collection<String> processCategoryNotInList) {\n        if (processCategoryNotInList == null) {","sourceCodeStart":604,"sourceCodeEnd":640,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java#L604-L640","documentation":"HistoricTaskInstanceQueryImpl.processCategoryIn(Collection<String>) throws FlowableIllegalArgumentException('Process category list is empty') when given a non-null but zero-size collection, because an IN predicate with no values is invalid. At least one category must be supplied.","triggerScenarios":"Calling processCategoryIn(Collections.emptyList()) or a list that was emptied by prior filtering just before the query is built.","commonSituations":"UI filters where the user deselects all categories and the empty selection is passed through; downstream filtering (e.g. permission-based) removing every category.","solutions":["Short-circuit: if the category list is empty, return no results (or drop the filter if an empty selection means 'no restriction').","Only call processCategoryIn when the list has at least one element.","Ensure upstream filtering doesn't silently remove all categories."],"exampleFix":"// before\nquery.processCategoryIn(selectedCategories); // empty -> exception\n\n// after\nif (selectedCategories.isEmpty()) {\n    return Collections.emptyList();\n}\nquery.processCategoryIn(selectedCategories);","handlingStrategy":"validation","validationCode":"if (categories == null || categories.isEmpty()) {\n    return Collections.emptyList(); // or drop the filter if empty means 'no restriction'\n}","typeGuard":"boolean isUsableCategoryList(Collection<String> c) { return c != null && !c.isEmpty(); }","tryCatchPattern":null,"preventionTips":["Define explicit semantics for empty category selections in the UI/service layer","Short-circuit queries when filter sets are empty","Ensure permission-based filtering never silently removes all categories"],"tags":["query","empty-collection","task-history","validation"],"backgroundTag":"empty-required-field","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"}