Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Update litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py

Harshit Jain36e63bd1eebb
diff --git a/litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py b/litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py
index 779700caf55..ab3ad82e3ce 100644
--- a/litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py
+++ b/litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py
@@ -142,6 +142,11 @@ async def update_jwt_key_mapping(
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.")