From 36e63bd1eebbacbf8a5034536167a8174b7af09a Mon Sep 17 00:00:00 2001 From: Harshit Jain <48647625+Harshit28j@users.noreply.github.com> Date: Thu, 5 Mar 2026 04:12:54 +0530 Subject: [PATCH] Update litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- .../proxy/management_endpoints/jwt_key_mapping_endpoints.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py b/litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py index 779700caf5..ab3ad82e3c 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.")