{"record":{"id":"c30731bcdf367d90","repo":"flowable/flowable-engine","slug":"involvedgroups-is-null","errorCode":null,"errorMessage":"involvedGroups is null","messagePattern":"involvedGroups is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricPlanItemInstanceQueryImpl.java","lineNumber":372,"sourceCode":"    }\n    \n    @Override\n    public HistoricPlanItemInstanceQuery involvedUser(String involvedUser) {\n        if (involvedUser == null) {\n            throw new FlowableIllegalArgumentException(\"involvedUser is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.involvedUser = involvedUser;\n        } else {\n            this.involvedUser = involvedUser;\n        }\n        return this;\n    }\n    \n    @Override\n    public HistoricPlanItemInstanceQuery involvedGroups(Collection<String> involvedGroups) {\n        if (involvedGroups == null) {\n            throw new FlowableIllegalArgumentException(\"involvedGroups is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.involvedGroups = involvedGroups;\n        } else {\n            this.involvedGroups = involvedGroups;\n        }\n        return this;\n    }\n    \n    @Override\n    public HistoricPlanItemInstanceQuery onlyStages() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.onlyStages = true;\n        } else {\n            this.onlyStages = true;\n        }\n        return this;\n    }","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricPlanItemInstanceQueryImpl.java#L354-L390","documentation":"HistoricPlanItemInstanceQuery.involvedGroups() requires a non-null collection of group ids. Flowable throws FlowableIllegalArgumentException when null is passed; an empty collection is accepted but null is rejected because it is indistinguishable from the filter not being set. The collection is applied to the main query or the current OR-query object.","triggerScenarios":"Calling historicPlanItemInstanceQuery.involvedGroups(null), typically involvedGroups(userService.getGroupsForUser(userId)) where the user has no groups and the service returns null instead of an empty list, or a JSON field being absent.","commonSituations":"Group-based access filtering where identity/group lookup APIs return null for users without memberships; configuration objects with unset group lists; REST payloads omitting the groups array.","solutions":["Pass a non-null collection (an empty List/Collection is fine if there are no groups).","Coalesce null group lookups to an empty list before calling: Collections.emptyList().","Only invoke involvedGroups when the collection is non-null; otherwise skip the filter.","Fix the identity/group service so it returns an empty collection instead of null for users with no groups."],"exampleFix":"// before\nquery.involvedGroups(identityService.getGroupsForUser(userId));\n\n// after\nList<String> groups = identityService.getGroupsForUser(userId);\nquery.involvedGroups(groups != null ? groups : Collections.emptyList());","handlingStrategy":"validation","validationCode":"if (involvedGroups == null) {\n    involvedGroups = Collections.emptyList();\n}\nif (!involvedGroups.isEmpty()) {\n    query.involvedGroups(involvedGroups);\n}","typeGuard":"boolean hasGroups(Collection<String> groups) {\n    return groups != null && !groups.isEmpty();\n}","tryCatchPattern":"try {\n    query.involvedGroups(involvedGroups);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Invalid involvedGroups filter: {}\", e.getMessage());\n    // default to no group filter or return a validation error\n}","preventionTips":["Coalesce group lookups to Collections.emptyList() — null collections, not empty ones, trigger this error.","Ensure identity/group services return empty collections instead of null.","Use Optional<List<String>> in service APIs to make 'no groups' explicit.","Apply group filters only when the collection is non-empty."],"tags":["flowable","cmmn","query","null-argument","identity-links"],"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"}