{"record":{"id":"d2d406bfc7020e17","repo":"flowable/flowable-engine","slug":"involved-groups-are-empty-d2d406","errorCode":null,"errorMessage":"Involved groups are empty","messagePattern":"Involved groups are 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":609,"sourceCode":"    public TaskQueryImpl taskInvolvedUser(String involvedUser) {\n        if (involvedUser == null) {\n            throw new FlowableIllegalArgumentException(\"Involved user is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.involvedUser = involvedUser;\n        } else {\n            this.involvedUser = involvedUser;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl taskInvolvedGroups(Collection<String> involvedGroups) {\n        if (involvedGroups == null) {\n            throw new FlowableIllegalArgumentException(\"Involved groups are null\");\n        }\n        if (involvedGroups.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Involved groups are empty\");\n        }\n        if (orActive) {\n            currentOrQueryObject.involvedGroups = involvedGroups;\n        } else {\n            this.involvedGroups = involvedGroups;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl taskCandidateGroup(String candidateGroup) {\n        if (candidateGroup == null) {\n            throw new FlowableIllegalArgumentException(\"Candidate group is null\");\n        }\n\n        if (candidateGroups != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both candidateGroup and candidateGroupIn\");\n        }","sourceCodeStart":591,"sourceCodeEnd":627,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L591-L627","documentation":"TaskQueryImpl.taskInvolvedGroups() throws this when the passed collection is non-null but empty. An empty collection would yield an invalid IN () clause or match nothing, so Flowable rejects it explicitly. Use null/omission for 'no filter' instead of an empty list.","triggerScenarios":"Calling taskQuery.taskInvolvedGroups(new ArrayList<>()) or any collection where isEmpty() is true, often the result of filtering a group list to zero entries.","commonSituations":"Group list computed at runtime (e.g. user's groups) ends up empty because the user belongs to no groups; upstream filter removed all items; default-initialized empty list passed unconditionally.","solutions":["Only call taskInvolvedGroups() when the collection has at least one element.","Handle the empty case by skipping the filter or returning an intentionally empty result.","Fix the logic that produces an empty group list if groups are mandatory.","If 'no groups' is valid, model it by not setting the filter rather than passing an empty list."],"exampleFix":"// before\nTaskQuery query = taskService.createTaskQuery().taskInvolvedGroups(groups);\n// after\nTaskQuery query = taskService.createTaskQuery();\nif (groups != null && !groups.isEmpty()) {\n    query = query.taskInvolvedGroups(groups);\n}","handlingStrategy":"validation","validationCode":"if (involvedGroups == null || involvedGroups.isEmpty()) {\n    throw new IllegalArgumentException(\"involvedGroups must contain at least one group\");\n}\nquery.taskInvolvedGroups(involvedGroups);","typeGuard":"boolean isNonEmptyGroups(Collection<String> g) { return g != null && !g.isEmpty(); }","tryCatchPattern":"try {\n    query.taskInvolvedGroups(groups);\n} catch (FlowableIllegalArgumentException e) {\n    logger.warn(\"Empty/null involved groups: {}\", e.getMessage());\n    return Collections.emptyList(); // or skip the filter\n}","preventionTips":["Treat 'no filter' as omitting the setter, not passing an empty list","Decide explicit semantics for the empty-groups case (empty result vs unfiltered)","Validate collections after any filtering/reduction step","Cover empty-list inputs in query-builder tests"],"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"}