BerriAI/litellm · error · HTTPException

Failed to delete JWT key mapping.

Error message

Failed to delete JWT key mapping.

What it means

Error "Failed to delete JWT key mapping." thrown in BerriAI/litellm.

Solutions

  1. Check proxy logs for the underlying database error.
  2. Verify the mapping exists and the database connection is healthy, then retry.

When it happens

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

Appendix: source

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

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

    try:
        # Get old mapping for cache invalidation
        old_mapping: Final = await JWTKeyMappingRepository(prisma_client).table.find_unique(where={"id": data.id})

        if old_mapping is None:
            raise HTTPException(status_code=404, detail="Mapping not found")

        cache_key: Final = f"jwt_key_mapping:{old_mapping.jwt_claim_name}:{old_mapping.jwt_claim_value}"
        await user_api_key_cache.async_delete_cache(cache_key)

        await JWTKeyMappingRepository(prisma_client).table.delete(where={"id": data.id})
        return {"status": "success"}
    except HTTPException:
        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:

View on GitHub (pinned to 77b7c6c40c)