BerriAI/litellm · error · HTTPException

Only admin users can query all teams/other teams. Your user

Error message

Only admin users can query all teams/other teams. Your user role={user_api_key_dict.user_role}

What it means

Error "Only admin users can query all teams/other teams. Your user role={user_api_key_dict.user_role}" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/team_endpoints.py:4765

            )
        # When the caller is an org admin querying their own teams (or no
        # specific user), null out user_id so that
        # _build_team_list_where_conditions scopes only by organization_id
        # — org admins should see all teams in their orgs, not just teams
        # they are a direct member of.  Keep user_id when the org admin
        # explicitly queries a *different* user's teams.
        if user_id is None or user_id == user_api_key_dict.user_id:
            user_id = None
        verbose_proxy_logger.debug(
            "list_team_v2: org admin access for user=%s, org_ids=%s, user_id_filter=%s",
            user_api_key_dict.user_id,
            org_admin_org_ids,
            user_id,
        )
    else:
        # Not an org admin — fall back to standard route check
        if not allowed_route_check_inside_route(user_api_key_dict=user_api_key_dict, requested_user_id=user_id):
            raise HTTPException(
                status_code=401,
                detail={
                    "error": f"Only admin users can query all teams/other teams. Your user role={user_api_key_dict.user_role}"
                },
            )
        # Regular user — auto-inject caller's user_id
        if user_id is None:
            user_id = user_api_key_dict.user_id

    return user_id, org_admin_org_ids


@router.get(
    "/v2/team/list",
    tags=["team management"],
    response_model=TeamListResponse,
    dependencies=[Depends(user_api_key_auth)],
)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a proxy admin key to query all/other teams, or restrict the query to your own teams.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/team_endpoints.py:4765 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/5d1deb6002d62c86. Report an issue: GitHub.