{"record":{"id":"b744601b97a44b74","repo":"flowable/flowable-engine","slug":"task-category-list-is-null-b74460","errorCode":null,"errorMessage":"Task category list is null","messagePattern":"Task category list is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java","lineNumber":1167,"sourceCode":"        } else {\n            this.categoryNotInList = taskCategoryNotInList;\n        }\n        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        }","sourceCodeStart":1149,"sourceCodeEnd":1185,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L1149-L1185","documentation":"The internal helper checkTaskCategoryList() (used by taskCategoryIn) requires a non-null collection of task categories to build the IN clause. A null collection is rejected with FlowableIllegalArgumentException before any query runs.","triggerScenarios":"Calling taskService.createTaskQuery().taskCategoryIn(null), typically when the category list is built dynamically from configuration or user selection.","commonSituations":"Category filter loaded from a missing config key; UI multi-select serialized with no field present.","solutions":["Pass a non-null collection of category strings","Null-check the source list and either omit the filter or default to the application's standard categories","Make the producer return an empty list (then handle emptiness) instead of null"],"exampleFix":"// before\nquery.taskCategoryIn(categories); // categories may be null\n// after\nif (categories != null && !categories.isEmpty()) {\n    query.taskCategoryIn(categories);\n}","handlingStrategy":"validation","validationCode":"if (categories == null) {\n    throw new IllegalArgumentException(\"task categories must not be null\");\n}\nquery.taskCategoryIn(categories);","typeGuard":"boolean isQueryableCategoryList(Collection<String> c) { return c != null && !c.isEmpty() && c.stream().allMatch(Objects::nonNull); }","tryCatchPattern":"try {\n    tasks = taskService.createTaskQuery().taskCategoryIn(categories).list();\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    log.warn(\"Invalid category filter: {}\", e.getMessage());\n    tasks = Collections.emptyList();\n}","preventionTips":["Default category lists from config with a non-null fallback (List.of())","Validate DTO fields with @NotNull/@NotEmpty at the REST boundary","Never initialize collection fields to null; use empty collections"],"tags":["flowable","task-query","null-argument","collection"],"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"}