BerriAI/litellm · error · HTTPException
A mapping with those claim values already exists.
Error message
A mapping with those claim values already exists.
What it means
Error "A mapping with those claim values already exists." thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py:135
cache_key = f"jwt_key_mapping:{old_mapping.jwt_claim_name}:{old_mapping.jwt_claim_value}"
await user_api_key_cache.async_delete_cache(cache_key)
updated_mapping: Final = await JWTKeyMappingRepository(prisma_client).table.update(
where={"id": data.id}, data=update_data
)
# Invalidate new cache key if claim fields changed
cache_key = f"jwt_key_mapping:{updated_mapping.jwt_claim_name}:{updated_mapping.jwt_claim_value}"
await user_api_key_cache.async_delete_cache(cache_key)
return _to_response(updated_mapping)
except HTTPException:
raise
except Exception as e:
error_str: Final = str(e).lower()
if "unique" in error_str or "p2002" in error_str:
raise HTTPException(
status_code=409,
detail="A mapping with those claim values already exists.",
)
if "foreign" in error_str or "p2003" in error_str:
raise HTTPException(
status_code=400,
detail="The provided key does not match an existing virtual key.",
)
raise HTTPException(status_code=500, detail="Failed to update JWT key mapping.")
@router.post("/jwt/key/mapping/delete", tags=["JWT Key Mapping"])
async def delete_jwt_key_mapping(
data: DeleteJWTKeyMappingRequest,
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
):
from litellm.proxy.proxy_server import prisma_client, user_api_key_cache
View on GitHub (pinned to 77b7c6c40c)
Solutions
- List existing mappings and update the existing one instead of creating a duplicate.
- Choose different claim values that do not collide with an existing mapping.
When it happens
Trigger: Thrown at litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py:135 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/26e75d5fc28751f5.
Report an issue: GitHub.