BerriAI/litellm · error · HTTPException

f"User {user_id} is not within your admin scope. Only PROXY_

Error message

f"User {user_id} is not within your admin scope. Only PROXY_ADMIN may delete users outside your administered organizations."

What it means

Error "f"User {user_id} is not within your admin scope. Only PROXY_ADMIN may delete users outside your administered organizations."" thrown in BerriAI/litellm.

Source

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

            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:
        user_row = await UserRepository(prisma_client).table.find_unique(where={"user_id": user_id})

        if user_row is None:
            raise HTTPException(
                status_code=404,
                detail={"error": f"User not found, passed user_id={user_id}"},
            )

        if not caller_is_proxy_admin:
            target_org_ids = target_org_ids_by_user.get(user_id, set())
            # Org-admin may only delete users whose entire org membership is
            # within their admin scope. A target with ANY org outside the
            # caller's scope (or no org at all) requires PROXY_ADMIN.
            if not target_org_ids or not target_org_ids.issubset(caller_admin_org_ids):
                raise HTTPException(
                    status_code=403,
                    detail={
                        "error": (
                            f"User {user_id} is not within your admin scope. "
                            "Only PROXY_ADMIN may delete users outside your "
                            "administered organizations."
                        )
                    },
                )

        # Enterprise Feature - Audit Logging. Enable with litellm.store_audit_logs = True
        # we do this after the first for loop, since first for loop is for validation. we only want this inserted after validation passes
        if litellm.store_audit_logs is True:
            # make an audit log for each team deleted
            _user_row = user_row.json(exclude_none=True)

            asyncio.create_task(
                create_audit_log_for_update(

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Ask a PROXY_ADMIN to delete this user, since they are outside your administered organizations.
  2. Delete only users who belong to organizations you administer.

When it happens

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