BerriAI/litellm · error · HTTPException

Admin access required

Error message

Admin access required

What it means

Raised by the approve/reject guardrail-submission endpoints when the caller lacks admin privileges — submission review is an admin-only workflow (a non-admin reviewer approving their own team's guardrail would defeat the review gate). It is a role check on user_api_key_dict, fired before the submission row is even fetched.

Source

Thrown at litellm/proxy/guardrails/guardrail_endpoints.py:1004

    except Exception as e:
        verbose_proxy_logger.exception("Error getting guardrail submission: %s", e)
        raise HTTPException(status_code=500, detail=str(e))


@router.post(
    "/guardrails/submissions/{guardrail_id}/approve",
    tags=["Guardrails"],
)
async def approve_guardrail_submission(
    guardrail_id: str,
    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
):
    """Approve a pending guardrail submission: set status to active and initialize in memory (admin only)."""
    from litellm.proxy.guardrails.guardrail_registry import IN_MEMORY_GUARDRAIL_HANDLER
    from litellm.proxy.proxy_server import prisma_client

    if user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN:
        raise HTTPException(status_code=403, detail="Admin access required")

    if prisma_client is None:
        raise HTTPException(status_code=500, detail="Prisma client not initialized")

    try:
        row: Final = await _guardrails_table(prisma_client).find_unique(where={"guardrail_id": guardrail_id})
        if row is None:
            raise HTTPException(status_code=404, detail="Guardrail submission not found")
        if row.status != "pending_review":
            raise HTTPException(
                status_code=400,
                detail=f"Guardrail is not pending review (status={row.status})",
            )

        now: Final = datetime.now(timezone.utc)
        await _guardrails_table(prisma_client).update(
            where={"guardrail_id": guardrail_id},
            data={"status": "active", "reviewed_at": now, "updated_at": now},

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a proxy admin key for this operation.

Example fix

Retry with Authorization: Bearer $LITELLM_MASTER_KEY or an admin key.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/guardrails/guardrail_endpoints.py:1004 when the library encounters an invalid state.

Common situations: A non-admin attempted an admin-only guardrail operation.


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