{"record":{"id":"5d1deb6002d62c86","repo":"BerriAI/litellm","slug":"only-admin-users-can-query-all-teams-other-teams","errorCode":null,"errorMessage":"Only admin users can query all teams/other teams. Your user role={user_api_key_dict.user_role}","messagePattern":"Only admin users can query all teams/other teams\\. Your user role=(.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":401,"severity":"error","filePath":"litellm/proxy/management_endpoints/team_endpoints.py","lineNumber":4765,"sourceCode":"            )\n        # When the caller is an org admin querying their own teams (or no\n        # specific user), null out user_id so that\n        # _build_team_list_where_conditions scopes only by organization_id\n        # — org admins should see all teams in their orgs, not just teams\n        # they are a direct member of.  Keep user_id when the org admin\n        # explicitly queries a *different* user's teams.\n        if user_id is None or user_id == user_api_key_dict.user_id:\n            user_id = None\n        verbose_proxy_logger.debug(\n            \"list_team_v2: org admin access for user=%s, org_ids=%s, user_id_filter=%s\",\n            user_api_key_dict.user_id,\n            org_admin_org_ids,\n            user_id,\n        )\n    else:\n        # Not an org admin — fall back to standard route check\n        if not allowed_route_check_inside_route(user_api_key_dict=user_api_key_dict, requested_user_id=user_id):\n            raise HTTPException(\n                status_code=401,\n                detail={\n                    \"error\": f\"Only admin users can query all teams/other teams. Your user role={user_api_key_dict.user_role}\"\n                },\n            )\n        # Regular user — auto-inject caller's user_id\n        if user_id is None:\n            user_id = user_api_key_dict.user_id\n\n    return user_id, org_admin_org_ids\n\n\n@router.get(\n    \"/v2/team/list\",\n    tags=[\"team management\"],\n    response_model=TeamListResponse,\n    dependencies=[Depends(user_api_key_auth)],\n)","sourceCodeStart":4747,"sourceCodeEnd":4783,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/team_endpoints.py#L4747-L4783","documentation":"Error \"Only admin users can query all teams/other teams. Your user role={user_api_key_dict.user_role}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/team_endpoints.py:4765 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a proxy admin key to query all/other teams, or restrict the query to your own teams."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}