BerriAI/litellm · error · HTTPException

Only proxy admins can list JWT key mappings

Error message

Only proxy admins can list JWT key mappings

What it means

Error "Only proxy admins can list JWT key mappings" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py:191

        raise
    except Exception:
        raise HTTPException(status_code=500, detail="Failed to delete JWT key mapping.")


@router.get(
    "/jwt/key/mapping/list",
    tags=["JWT Key Mapping"],
)
async def list_jwt_key_mappings(
    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
    page: int = Query(1, description="Page number", ge=1),
    size: int = Query(50, description="Page size", ge=1, le=100),
):
    from litellm.proxy.proxy_server import prisma_client

    # Admin Viewer follows the read-parity rule.
    if not _user_has_admin_view(user_api_key_dict):
        raise HTTPException(status_code=403, detail="Only proxy admins can list JWT key mappings")

    if prisma_client is None:
        raise HTTPException(status_code=500, detail="Database not connected")

    try:
        skip: Final = (page - 1) * size
        mappings: Final = await JWTKeyMappingRepository(prisma_client).table.find_many(
            skip=skip,
            take=size,
            order={"created_at": "desc"},
        )
        total_count: Final = await JWTKeyMappingRepository(prisma_client).table.count()
        return {
            "mappings": [_to_response(m) for m in mappings],
            "total_count": total_count,
            "current_page": page,
            "total_pages": -(-total_count // size),  # ceiling division
        }

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Authenticate with a proxy admin API key.
  2. Ask a proxy admin to list the JWT key mappings for you.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py:191 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/d3b34d67b8c030fe. Report an issue: GitHub.