{"record":{"id":"04cbd8720167eef0","repo":"openai/openai-python","slug":"expected-a-non-empty-value-for-group-id-but-rece-04cbd8","errorCode":null,"errorMessage":"Expected a non-empty value for `group_id` but received {group_id!r}","messagePattern":"Expected a non-empty value for `group_id` but received (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/openai/resources/admin/organization/groups/users.py","lineNumber":73,"sourceCode":"        extra_body: Body | None = None,\n        timeout: float | httpx2.Timeout | None | NotGiven = not_given,\n    ) -> UserCreateResponse:\n        \"\"\"\n        Adds a user to a group.\n\n        Args:\n          user_id: Identifier of the user to add to the group.\n\n          extra_headers: Send extra headers\n\n          extra_query: Add additional query parameters to the request\n\n          extra_body: Add additional JSON properties to the request\n\n          timeout: Override the client-level default timeout for this request, in seconds\n        \"\"\"\n        if not group_id:\n            raise ValueError(f\"Expected a non-empty value for `group_id` but received {group_id!r}\")\n        return self._post(\n            path_template(\"/organization/groups/{group_id}/users\", group_id=group_id),\n            body=maybe_transform({\"user_id\": user_id}, user_create_params.UserCreateParams),\n            options=make_request_options(\n                extra_headers=extra_headers,\n                extra_query=extra_query,\n                extra_body=extra_body,\n                timeout=timeout,\n                security={\"admin_api_key_auth\": True},\n            ),\n            cast_to=UserCreateResponse,\n        )\n\n    def retrieve(\n        self,\n        user_id: str,\n        *,\n        group_id: str,","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/admin/organization/groups/users.py#L55-L91","documentation":"Adding a user to a group (users.py:73) requires a non-empty group_id for POST /organization/groups/{group_id}/users; a falsy value raises ValueError before the user_id body is transformed. This is the same generated guard pattern applied to the users nested resource.","triggerScenarios":"client.admin.organization.groups.users.create(group_id='', user_id='user_1'); typical when the group ID and user ID come from different sources and one is missing.","commonSituations":"Onboarding automation adding users to groups where the group env var is unset; CSV imports with blank group columns.","solutions":["Resolve both group_id and user_id from authoritative sources before the call","Validate both are non-empty strings in a pre-flight check","Store group/user ID mappings in one validated config"],"exampleFix":"# before\nclient.admin.organization.groups.users.create(group_id=gid, user_id=uid)\n\n# after\nif not gid or not uid:\n    raise ValueError(f'need group_id and user_id, got {gid!r}, {uid!r}')\nclient.admin.organization.groups.users.create(group_id=gid, user_id=uid)","handlingStrategy":"validation","validationCode":"if not group_id or not user_id:\n    raise ValueError(f'need group_id and user_id, got {group_id!r}, {user_id!r}')\nclient.admin.organization.groups.users.create(group_id=group_id, user_id=user_id)","typeGuard":"def are_valid_ids(*ids: object) -> bool:\n    return all(isinstance(i, str) and i.strip() for i in ids)","tryCatchPattern":null,"preventionTips":["Validate both IDs together for membership operations","Reject CSV/import rows with blank group or user IDs","Use keyword arguments to avoid swapped parameters"],"tags":["openai","admin-api","groups","users","path-parameter","valueerror"],"backgroundTag":"missing-required-parameter","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}