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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Fix: get_user_object raises on missing user, never returns None
Alejandro Tapia1c04016d7bce
diff --git a/litellm/proxy/management_endpoints/internal_user_endpoints.py b/litellm/proxy/management_endpoints/internal_user_endpoints.pyindex d88d2810193..3d799c5731c 100644--- a/litellm/proxy/management_endpoints/internal_user_endpoints.py+++ b/litellm/proxy/management_endpoints/internal_user_endpoints.py@@ -1867,13 +1867,22 @@ async def ui_view_users("error": "Only proxy admins and organization admins can search users."},)- caller_user = await get_user_object(- user_id=user_api_key_dict.user_id,- prisma_client=prisma_client,- user_api_key_cache=user_api_key_cache,- user_id_upsert=False,- proxy_logging_obj=proxy_logging_obj,- )+ try:+ caller_user = await get_user_object(+ user_id=user_api_key_dict.user_id,+ prisma_client=prisma_client,+ user_api_key_cache=user_api_key_cache,+ user_id_upsert=False,+ proxy_logging_obj=proxy_logging_obj,+ )+ except ValueError:+ # get_user_object raises ValueError when user not found (user_id_upsert=False)+ raise HTTPException(+ status_code=403,+ detail={+ "error": "Only proxy admins and organization admins can search users."+ },+ )if caller_user is None:raise HTTPException(status_code=403,