diff --git a/litellm/proxy/common_utils/http_parsing_utils.py b/litellm/proxy/common_utils/http_parsing_utils.py index 6ded2f000c..875d69437c 100644 --- a/litellm/proxy/common_utils/http_parsing_utils.py +++ b/litellm/proxy/common_utils/http_parsing_utils.py @@ -5,6 +5,7 @@ import orjson from fastapi import Request, UploadFile, status from litellm._logging import verbose_proxy_logger +from litellm.proxy._types import ProxyException from litellm.types.router import Deployment @@ -44,8 +45,8 @@ async def _read_request_body(request: Optional[Request]) -> Dict: else: try: parsed_body = orjson.loads(body) - except orjson.JSONDecodeError: - # Fall back to the standard json module which is more forgiving + except orjson.JSONDecodeError as e: + # First try the standard json module which is more forgiving # First decode bytes to string if needed body_str = body.decode("utf-8") if isinstance(body, bytes) else body @@ -61,15 +62,26 @@ async def _read_request_body(request: Optional[Request]) -> Dict: r"(?