{"record":{"id":"a437b64cdbd8a4cc","repo":"openai/openai-python","slug":"expected-a-non-empty-value-for-group-id-but-rece-a437b6","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/projects/groups/roles.py","lineNumber":76,"sourceCode":"    ) -> RoleCreateResponse:\n        \"\"\"\n        Assigns a project role to a group within a project.\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 project_id:\n            raise ValueError(f\"Expected a non-empty value for `project_id` but received {project_id!r}\")\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(\"/projects/{project_id}/groups/{group_id}/roles\", project_id=project_id, 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        project_id: str,","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/admin/organization/projects/groups/roles.py#L58-L94","documentation":"Raised client-side by the openai-python SDK before any HTTP request. Assigning a role to a group via client.admin.organization.projects.groups.roles.create(...) requires a non-empty group_id because it forms /projects/{project_id}/groups/{group_id}/roles. An empty group_id would corrupt the URL path, so the SDK raises ValueError immediately with the received value.","triggerScenarios":"Calling roles.create(project_id=..., group_id='', role_id=...) where the group_id variable is None, an empty string, or a lookup result for a group that was never created/fetched.","commonSituations":"Creating a group and assigning its role in one flow but reading the id from the wrong response field; group creation failed silently upstream; ids parsed from malformed input files.","solutions":["Capture group.id from the groups.create(...) response and pass that exact value.","Check that the group actually exists via groups.retrieve/list before assigning roles.","Validate non-empty group_id and role_id before the call."],"exampleFix":"# before\nclient.admin.organization.projects.groups.roles.create(project_id=pid, group_id=gid, role_id=rid)\n\n# after\ngid = group.id if group and group.id else None\nif not gid:\n    raise RuntimeError(\"group id missing; creation may have failed\")\nclient.admin.organization.projects.groups.roles.create(project_id=pid, group_id=gid, role_id=rid)","handlingStrategy":"validation","validationCode":"gid = group.id if group else None\nif not gid:\n    raise RuntimeError(\"group id missing; was the group created?\")\nclient.admin.organization.projects.groups.roles.create(project_id=project_id, group_id=gid, role_id=role_id)","typeGuard":"def has_group_id(obj: object) -> bool:\n    return obj is not None and isinstance(getattr(obj, \"id\", None), str) and bool(obj.id)","tryCatchPattern":"try:\n    client.admin.organization.projects.groups.roles.create(project_id=pid, group_id=gid, role_id=rid)\nexcept ValueError as e:\n    if \"group_id\" in str(e):\n        gid = client.admin.organization.projects.groups.retrieve(project_id=pid, group_id=known).id\n    else:\n        raise","preventionTips":["Chain dependent creates off the previous response's id field.","Check the create response for an id before using it.","Avoid manually assembling ids from names or partial data."],"tags":["openai-python","admin-api","validation","path-parameter","roles"],"backgroundTag":"missing-required-parameter","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}