{"record":{"id":"3c97574c29f73e79","repo":"flowable/flowable-engine","slug":"task-category-list-is-empty-3c9757","errorCode":null,"errorMessage":"Task category list is empty","messagePattern":"Task category list is empty","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java","lineNumber":1170,"sourceCode":"        return this;\n    }\n\n    @Override\n    public TaskQuery taskWithoutCategory() {\n        if (orActive) {\n            currentOrQueryObject.withoutCategory = true;\n        } else {\n            this.withoutCategory = true;\n        }\n        return this;\n    }\n\n    protected void checkTaskCategoryList(Collection<String> taskCategoryInList) {\n        if (taskCategoryInList == null) {\n            throw new FlowableIllegalArgumentException(\"Task category list is null\");\n        }\n        if (taskCategoryInList.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Task category list is empty\");\n        }\n        for (String category : taskCategoryInList) {\n            if (category == null) {\n                throw new FlowableIllegalArgumentException(\"None of the given task categories can be null\");\n            }\n        }\n    }\n\n    @Override\n    public TaskQuery taskWithFormKey() {\n        if (orActive) {\n            currentOrQueryObject.withFormKey = true;\n        } else {\n            this.withFormKey = true;\n        }\n        return this;\n    }\n","sourceCodeStart":1152,"sourceCodeEnd":1188,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L1152-L1188","documentation":"checkTaskCategoryList() rejects an empty category collection because an empty SQL IN () is invalid and matches nothing. Flowable throws FlowableIllegalArgumentException so the caller must handle the 'no categories selected' case explicitly.","triggerScenarios":"Calling .taskCategoryIn(Collections.emptyList()) or a list reduced to zero items by prior filtering.","commonSituations":"UI filters where the user unselected all categories; config lists trimmed to empty after sanitization.","solutions":["Check isEmpty() before calling and return an empty result early","Or skip the category filter if empty should mean 'all categories' (confirm intended semantics)","Default to a sensible category set when none are provided"],"exampleFix":"// before\nquery.taskCategoryIn(selectedCategories); // may be empty\n// after\nif (selectedCategories.isEmpty()) {\n    return Collections.emptyList();\n}\nquery.taskCategoryIn(selectedCategories);","handlingStrategy":"validation","validationCode":"if (categories == null || categories.isEmpty()) {\n    return Collections.emptyList();\n}\nquery.taskCategoryIn(categories);","typeGuard":"boolean nonEmpty(Collection<?> c) { return c != null && !c.isEmpty(); }","tryCatchPattern":"try {\n    tasks = taskService.createTaskQuery().taskCategoryIn(categories).list();\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    log.warn(\"Empty/null category list: {}\", e.getMessage());\n    tasks = Collections.emptyList();\n}","preventionTips":["Decide explicitly whether empty selection means 'no results' or 'all categories' and encode it once","Short-circuit before calling the query builder","Test UI filter flows with zero selections"],"tags":["flowable","task-query","empty-collection","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"}