{"record":{"id":"9764a242e2a7bb5c","repo":"openai/openai-python","slug":"expected-a-non-empty-value-for-role-id-but-recei-9764a2","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/users/roles.py","lineNumber":120,"sourceCode":"    ) -> RoleRetrieveResponse:\n        \"\"\"\n        Retrieves a project role assigned to a user.\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 user_id:\n            raise ValueError(f\"Expected a non-empty value for `user_id` but received {user_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}/users/{user_id}/roles/{role_id}\",\n                project_id=project_id,\n                user_id=user_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/users/roles.py#L102-L138","documentation":"The sync Roles.retrieve method validates role_id last; an empty role_id raises this ValueError so that the URL path segment /roles/{role_id} is never rendered empty. No network request occurs.","triggerScenarios":"Calling roles.retrieve(project_id=..., user_id=..., role_id='') where the role id is blank or None.","commonSituations":"Hardcoding or copying a role_id that was truncated, or reading it from a response/object where the field was absent.","solutions":["Pass a valid role_id (e.g. 'role-...') obtained from roles.list or role creation","Validate all three path parameters before the call"],"exampleFix":"// before\nroles.retrieve(project_id=project_id, user_id=user_id, role_id=\"\")\n// after\nroles.retrieve(project_id=project_id, user_id=user_id, role_id=role_id)","handlingStrategy":"validation","validationCode":"if not role_id or not role_id.strip():\n    raise ValueError(\"role_id required for role lookup\")\nroles.retrieve(project_id=project_id, user_id=user_id, role_id=role_id)","typeGuard":"def is_valid_role_id(value: object) -> bool:\n    return isinstance(value, str) and bool(value.strip())","tryCatchPattern":"try:\n    roles.retrieve(project_id, user_id, role_id)\nexcept ValueError as e:\n    if \"role_id\" in str(e):\n        logger.warning(\"no role id; skipping: %s\", e)\n    else:\n        raise","preventionTips":["Copy role ids verbatim from roles.list output","Validate config entries for empty strings"],"tags":["openai","admin-api","rbac","validation","path-parameter"],"backgroundTag":"missing-required-parameter","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}