{"record":{"id":"6c35da99b0673443","repo":"openai/openai-python","slug":"expected-a-non-empty-value-for-role-id-but-recei-6c35da","errorCode":null,"errorMessage":"Expected a non-empty value for `role_id` but received {role_id!r}","messagePattern":"Expected a non-empty value for `role_id` but received (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/openai/resources/admin/organization/projects/groups/roles.py","lineNumber":120,"sourceCode":"    ) -> RoleRetrieveResponse:\n        \"\"\"\n        Retrieves a project role assigned to a group.\n\n        Args:\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        if not role_id:\n            raise ValueError(f\"Expected a non-empty value for `role_id` but received {role_id!r}\")\n        return self._get(\n            path_template(\n                \"/projects/{project_id}/groups/{group_id}/roles/{role_id}\",\n                project_id=project_id,\n                group_id=group_id,\n                role_id=role_id,\n            ),\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=RoleRetrieveResponse,\n        )\n\n    def list(","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/admin/organization/projects/groups/roles.py#L102-L138","documentation":"Raised client-side by the openai-python SDK before any HTTP request. Retrieving a group role via client.admin.organization.projects.groups.roles.retrieve(...) requires a non-empty role_id because it is the final path segment in /projects/{project_id}/groups/{group_id}/roles/{role_id}. An empty role_id would resolve to the collection URL, so the SDK validates it and raises ValueError with the received value.","triggerScenarios":"Calling roles.retrieve(project_id=..., group_id=..., role_id='') where role_id is None or empty — commonly a custom role id loaded from config that was never defined, or a builtin role name misspelled to an empty variable.","commonSituations":"Using custom role ids from an org settings file that lacks the entry; assuming role names like 'member' work where a role resource id is required; passing the whole role object instead of its id field.","solutions":["Confirm you are passing the role's id string (e.g. role.id), not the object or an empty variable.","List existing roles to find valid ids before retrieving.","Make the role id a required config value validated at startup."],"exampleFix":"# before\nrole = client.admin.organization.projects.groups.roles.retrieve(project_id=pid, group_id=gid, role_id=settings.get(\"role\"))\n\n# after\nrole_id = settings[\"role_id\"]\nrole = client.admin.organization.projects.groups.roles.retrieve(project_id=pid, group_id=gid, role_id=role_id)","handlingStrategy":"validation","validationCode":"if not role_id:\n    raise ValueError(f\"role_id required; got {role_id!r}\")\nrole = client.admin.organization.projects.groups.roles.retrieve(project_id=project_id, group_id=group_id, role_id=role_id)","typeGuard":"def valid_role_id(rid: object) -> bool:\n    return isinstance(rid, str) and rid.strip() != \"\"","tryCatchPattern":"try:\n    role = client.admin.organization.projects.groups.roles.retrieve(project_id=pid, group_id=gid, role_id=rid)\nexcept ValueError as e:\n    if \"role_id\" in str(e):\n        rid = find_role_id(client, pid, gid)\n    else:\n        raise","preventionTips":["Pass role.id from API objects, not names or config placeholders.","Make custom role ids required config validated at startup.","List roles on the group to discover valid ids when unsure."],"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"}