{"record":{"id":"5e55aa94246276bb","repo":"flowable/flowable-engine","slug":"provided-userid-is-null","errorCode":null,"errorMessage":"Provided userId is null","messagePattern":"Provided userId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/GroupQueryImpl.java","lineNumber":112,"sourceCode":"            throw new FlowableIllegalArgumentException(\"Provided name is null\");\n        }\n        this.nameLikeIgnoreCase = nameLikeIgnoreCase.toLowerCase();\n        return this;\n    }\n\n    @Override\n    public GroupQuery groupType(String type) {\n        if (type == null) {\n            throw new FlowableIllegalArgumentException(\"Provided type is null\");\n        }\n        this.type = type;\n        return this;\n    }\n\n    @Override\n    public GroupQuery groupMember(String userId) {\n        if (userId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided userId is null\");\n        }\n        this.userId = userId;\n        return this;\n    }\n\n    @Override\n    public GroupQuery groupMembers(List<String> userIds) {\n        if (userIds == null) {\n            throw new FlowableIllegalArgumentException(\"Provided userIds is null\");\n        }\n        this.userIds = userIds;\n        return this;\n    }\n\n    // sorting ////////////////////////////////////////////////////////\n\n    @Override\n    public GroupQuery orderByGroupId() {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/GroupQueryImpl.java#L94-L130","documentation":"Flowable's GroupQueryImpl.groupMember(String userId) throws FlowableIllegalArgumentException when the userId argument is null. The query API validates every criterion parameter eagerly so invalid queries fail at construction time rather than producing confusing SQL errors later. Passing null here means the query would be unexecutable or semantically meaningless.","triggerScenarios":"Calling groupMember(null) on a GroupQuery obtained from createGroupQuery(), typically when the userId variable was never initialized, came from an empty upstream lookup (e.g. userId = user.getId() where user is null), or was passed through unconditionally from caller code.","commonSituations":"Building dynamic group-membership queries where an optional filter is applied blindly; resolving a userId from a nullable entity or external request parameter; copy-pasted query-builder code that sets filters without null checks.","solutions":["Check for null before calling groupMember and only add the criterion when a valid userId exists","Use groupMembers(List) with a validated non-null list if you have multiple users, or skip the filter to query all groups","Default the userId to a sentinel value or handle the no-user case explicitly in your business logic"],"exampleFix":"// before\nGroupQuery query = identityService.createGroupQuery().groupMember(userId);\n// after\nGroupQuery query = identityService.createGroupQuery();\nif (userId != null) {\n    query.groupMember(userId);\n}","handlingStrategy":"validation","validationCode":"if (userId == null) { throw new IllegalArgumentException(\"userId must not be null before groupMember()\"); }","typeGuard":"boolean hasUserId(String userId) { return userId != null && !userId.isEmpty(); }","tryCatchPattern":"try { query.groupMember(userId); } catch (FlowableIllegalArgumentException e) { log.warn(\"Invalid group query: {}\", e.getMessage()); }","preventionTips":["Null-check every query criterion parameter before applying it","Build query objects in a helper that applies filters conditionally","Initialize nullable inputs with defaults or Optional at API boundaries"],"tags":["flowable","idm","query","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-14T05:17:10.506Z"}