BerriAI/litellm · error · HTTPException

Only PROXY_ADMIN or ORG_ADMIN users may delete users.

Error message

Only PROXY_ADMIN or ORG_ADMIN users may delete users.

What it means

Error "Only PROXY_ADMIN or ORG_ADMIN users may delete users." thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/internal_user_endpoints.py:2257

    # cross-check data.user_ids against the caller's scope, so without this
    # loop an org-admin of org-A could delete users in org-B by supplying
    # {"user_ids": [victim_in_org_B], "organization_id": "org-A"}.
    caller_is_proxy_admin: Final = user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value
    caller_admin_org_ids: set = set()
    if not caller_is_proxy_admin:
        caller_memberships: Final = (
            await _organization_membership_table(prisma_client).find_many(
                where={
                    "user_id": user_api_key_dict.user_id,
                    "user_role": LitellmUserRoles.ORG_ADMIN.value,
                }
            )
            if user_api_key_dict.user_id
            else []
        )
        caller_admin_org_ids = {m.organization_id for m in caller_memberships if m.organization_id}
        if not caller_admin_org_ids:
            raise HTTPException(
                status_code=403,
                detail={"error": "Only PROXY_ADMIN or ORG_ADMIN users may delete users."},
            )

    # Batch-fetch target memberships once before the per-user loop. Avoids
    # an N+1 DB call when delete_user is called with a large user_ids list.
    target_org_ids_by_user: Final[dict[str, set]] = {}
    if not caller_is_proxy_admin:
        all_target_memberships: Final = await _organization_membership_table(prisma_client).find_many(
            where={"user_id": {"in": data.user_ids}}
        )
        for m in all_target_memberships:
            if not m.organization_id:
                continue
            target_org_ids_by_user.setdefault(m.user_id, set()).add(m.organization_id)

    # check that all teams passed exist
    for user_id in data.user_ids:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Authenticate with a PROXY_ADMIN or ORG_ADMIN key to delete users.
  2. Ask an admin to perform the deletion on your behalf.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/internal_user_endpoints.py:2257 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/c83bb431c9eacdcd. Report an issue: GitHub.