BerriAI/litellm · error · HTTPException

Only proxy admin or team admin can modify team models

Error message

Only proxy admin or team admin can modify team models

What it means

Error "Only proxy admin or team admin can modify team models" thrown in BerriAI/litellm.

Source

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

    # Get existing team
    team_row: Final = await _team_db(prisma_client).find_unique(where={"team_id": data.team_id})

    if team_row is None:
        raise HTTPException(
            status_code=404,
            detail={"error": f"Team not found, passed team_id={data.team_id}"},
        )

    team_obj: Final = LiteLLM_TeamTable.model_validate(team_row.model_dump())

    # Authorization check - only proxy admin, team admin, or org admin can add models
    if (
        user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN.value
        and not _is_user_team_admin(user_api_key_dict=user_api_key_dict, team_obj=team_obj)
        and not await _is_user_org_admin_for_team(user_api_key_dict=user_api_key_dict, team_obj=team_obj)
    ):
        raise HTTPException(
            status_code=403,
            detail={"error": "Only proxy admin or team admin can modify team models"},
        )

    # Atomic array append with dedup at the database level so concurrent
    # BYOK model creates don't overwrite each other's team.models entries.
    # When the team currently has models=[] (unrestricted access), the
    # CASE expression inserts the 'all-proxy-models' sentinel first.
    models_to_add: Final = list(data.models)
    await prisma_client.db.execute_raw(
        'UPDATE "LiteLLM_TeamTable" '
        "SET models = ("
        "  SELECT ARRAY(SELECT DISTINCT unnest("
        "    CASE WHEN cardinality(COALESCE(models, ARRAY[]::text[])) = 0 "
        "         THEN ARRAY['all-proxy-models']::text[] "
        "         ELSE models "
        "    END || $1::text[]"
        "  ))"

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Call with a proxy admin key or a team admin key for the target team.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/team_endpoints.py:5294 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/64f4aa84dc992809. Report an issue: GitHub.