From ab1d2d0b337827ed2f611dde055ad3134b5fcbdf Mon Sep 17 00:00:00 2001 From: ShirGanon <45141251+ShirGanon@users.noreply.github.com> Date: Sat, 2 May 2026 14:35:29 +0300 Subject: [PATCH] fix(openai): add verbose_logger.debug for silent failure paths in try_parse_sse_response_body Address Greptile P2 suggestions: log when no SSE data lines are found and when stream_chunk_builder raises, so failures are observable in debug logs rather than silently falling back to the original error. --- litellm/llms/openai/common_utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/litellm/llms/openai/common_utils.py b/litellm/llms/openai/common_utils.py index a538223b853..ec4efa07e76 100644 --- a/litellm/llms/openai/common_utils.py +++ b/litellm/llms/openai/common_utils.py @@ -29,6 +29,7 @@ if TYPE_CHECKING: from litellm.types.utils import ModelResponse import litellm +from litellm._logging import verbose_logger from litellm.llms.base_llm.chat.transformation import BaseLLMException from litellm.llms.custom_httpx.http_handler import ( _DEFAULT_TTL_FOR_HTTPX_CLIENTS, @@ -322,13 +323,19 @@ def try_parse_sse_response_body(body: Optional[str]) -> Optional["ModelResponse" continue if not chunks: + verbose_logger.debug( + "try_parse_sse_response_body: no SSE data lines found in response body" + ) return None from litellm.types.utils import ModelResponse try: result = litellm.stream_chunk_builder(chunks=chunks) - except Exception: + except Exception as e: + verbose_logger.debug( + "try_parse_sse_response_body: stream_chunk_builder failed: %s", e + ) return None if not isinstance(result, ModelResponse): return None