{"record":{"id":"22a9e7612cdfff7d","repo":"flowable/flowable-engine","slug":"involvedgroups-are-null","errorCode":null,"errorMessage":"involvedGroups are null","messagePattern":"involvedGroups are null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java","lineNumber":857,"sourceCode":"    public CaseInstanceQuery involvedGroup(String groupId, String identityLinkType) {\n        if (groupId == null) {\n            throw new FlowableIllegalArgumentException(\"groupId is null\");\n        }\n        if (identityLinkType == null) {\n            throw new FlowableIllegalArgumentException(\"identityLinkType is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.involvedGroupIdentityLink = new IdentityLinkQueryObject(null, groupId, identityLinkType);\n        } else {\n            this.involvedGroupIdentityLink = new IdentityLinkQueryObject(null, groupId, identityLinkType);\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQuery involvedGroups(Set<String> groupIds) {\n        if (groupIds == null) {\n            throw new FlowableIllegalArgumentException(\"involvedGroups are null\");\n        }\n        if (groupIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"involvedGroups are empty\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.involvedGroups = groupIds;\n        } else {\n            this.involvedGroups = groupIds;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQuery or() {\n        if (inOrStatement) {\n            throw new FlowableException(\"the query is already in an or statement\");\n        }\n","sourceCodeStart":839,"sourceCodeEnd":875,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L839-L875","documentation":"CaseInstanceQueryImpl.involvedGroups(Set<String>) throws FlowableIllegalArgumentException with message 'involvedGroups are null' when the group id set is null. Flowable requires an actual set to filter on; a null set cannot be distinguished from 'no filter' by the engine.","triggerScenarios":"Calling caseInstanceQuery().involvedGroups(null), e.g. when a group list field in a filter DTO was never initialized or a service returned null instead of an empty collection.","commonSituations":"Search services aggregating the user's groups from an identity provider that returned null on failure; deserialized request bodies missing the groups field.","solutions":["Pass an empty Set (Collections.emptySet()) instead of null when no group filter is intended, or skip the call entirely when null.","Null-guard before the call: only apply involvedGroups when the set is non-null.","Fix the producer (identity/tenant lookup) to return an empty collection rather than null.","Add a DTO-level default so the groups field is always initialized to an empty set."],"exampleFix":"// before\nquery.involvedGroups(filter.getGroupIds());\n// after\nif (filter.getGroupIds() != null && !filter.getGroupIds().isEmpty()) {\n    query.involvedGroups(filter.getGroupIds());\n}","handlingStrategy":"validation","validationCode":"if (groupIds == null) {\n    throw new IllegalArgumentException(\"groupIds must not be null; use an empty check to skip the filter\");\n}\nquery.involvedGroups(groupIds);","typeGuard":"boolean isApplicableGroupFilter(Set<String> groupIds) {\n    return groupIds != null && !groupIds.isEmpty();\n}","tryCatchPattern":"try {\n    query.involvedGroups(groupIds);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"involvedGroups filter invalid: {}\", e.getMessage());\n    // fall back to query without group filter\n}","preventionTips":["Apply set-valued filters only when the set is non-null and non-empty","Make collection fields in filter DTOs default to empty collections","Ensure group lookups return empty collections instead of null"],"tags":["java","flowable","query-builder","null-check"],"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"}