{"record":{"id":"9b18318aa5cf7a34","repo":"openai/openai-python","slug":"expected-a-non-empty-value-for-group-id-but-rece-9b1831","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/roles.py","lineNumber":73,"sourceCode":"        extra_body: Body | None = None,\n        timeout: float | httpx2.Timeout | None | NotGiven = not_given,\n    ) -> RoleCreateResponse:\n        \"\"\"\n        Assigns an organization role to a group within the organization.\n\n        Args:\n          role_id: Identifier of the role to assign.\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}/roles\", group_id=group_id),\n            body=maybe_transform({\"role_id\": role_id}, role_create_params.RoleCreateParams),\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=RoleCreateResponse,\n        )\n\n    def retrieve(\n        self,\n        role_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/roles.py#L55-L91","documentation":"Role creation within a group (roles.py:73) requires a non-empty group_id for the POST /organization/groups/{group_id}/roles path; a falsy value raises ValueError before the role_id body is transformed. This is the standard generated guard for nested resources.","triggerScenarios":"client.admin.organization.groups.roles.create(group_id='', role_id='role_123'); typical when the parent group ID is a separate variable that was never populated.","commonSituations":"Scripts that attach roles to groups looked up earlier where the lookup returned nothing; hard-coded group IDs removed during refactoring.","solutions":["Populate group_id from the same code path that created/looked up the group","Validate both group_id and role_id before the call","Store verified group/role IDs together in one config object"],"exampleFix":"# before\nclient.admin.organization.groups.roles.create(group_id=gid, role_id=rid)\n\n# after\nif not gid or not rid:\n    raise ValueError(f'need both ids, got group={gid!r} role={rid!r}')\nclient.admin.organization.groups.roles.create(group_id=gid, role_id=rid)","handlingStrategy":"validation","validationCode":"if not group_id or not role_id:\n    raise ValueError('group_id and role_id are both required')\nclient.admin.organization.groups.roles.create(group_id=group_id, role_id=role_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 parent and child IDs together for nested resources","Keep group and role IDs in one config object to avoid divergence","Use keyword arguments to prevent swapped parameters"],"tags":["openai","admin-api","groups","roles","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"}