{"record":{"id":"c431c7d6497b8c0f","repo":"BerriAI/litellm","slug":"failed-to-delete-jwt-key-mapping","errorCode":null,"errorMessage":"Failed to delete JWT key mapping.","messagePattern":"Failed to delete JWT key mapping\\.","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py","lineNumber":175,"sourceCode":"    if prisma_client is None:\n        raise HTTPException(status_code=500, detail=\"Database not connected\")\n\n    try:\n        # Get old mapping for cache invalidation\n        old_mapping: Final = await JWTKeyMappingRepository(prisma_client).table.find_unique(where={\"id\": data.id})\n\n        if old_mapping is None:\n            raise HTTPException(status_code=404, detail=\"Mapping not found\")\n\n        cache_key: Final = f\"jwt_key_mapping:{old_mapping.jwt_claim_name}:{old_mapping.jwt_claim_value}\"\n        await user_api_key_cache.async_delete_cache(cache_key)\n\n        await JWTKeyMappingRepository(prisma_client).table.delete(where={\"id\": data.id})\n        return {\"status\": \"success\"}\n    except HTTPException:\n        raise\n    except Exception:\n        raise HTTPException(status_code=500, detail=\"Failed to delete JWT key mapping.\")\n\n\n@router.get(\n    \"/jwt/key/mapping/list\",\n    tags=[\"JWT Key Mapping\"],\n)\nasync def list_jwt_key_mappings(\n    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),\n    page: int = Query(1, description=\"Page number\", ge=1),\n    size: int = Query(50, description=\"Page size\", ge=1, le=100),\n):\n    from litellm.proxy.proxy_server import prisma_client\n\n    # Admin Viewer follows the read-parity rule.\n    if not _user_has_admin_view(user_api_key_dict):\n        raise HTTPException(status_code=403, detail=\"Only proxy admins can list JWT key mappings\")\n\n    if prisma_client is None:","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py#L157-L193","documentation":"Error \"Failed to delete JWT key mapping.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py:175 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check proxy logs for the underlying database error.","Verify the mapping exists and the database connection is healthy, then retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}