From 556592573d43cc0803e929ffd774bc116bf03b03 Mon Sep 17 00:00:00 2001 From: Charles Cheng Date: Fri, 19 Jun 2026 17:57:28 +0800 Subject: [PATCH] fix(logging): clarify ValueError message in google_genai generate_content else branch The else branch triggers when both httpx_response is invalid (None or wrong type) and result is not a dict. Previous message implied httpx_response was always None; new message explicitly names both failed conditions, making it easier to diagnose unexpected result types. --- litellm/litellm_core_utils/litellm_logging.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index e09e1bfa275..8b0450e93eb 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -3305,7 +3305,11 @@ class Logging(LiteLLMLoggingBaseClass): elif isinstance(result, dict): dict_result = result else: - raise ValueError("Google GenAI Generate Content: httpx_response is None") + raise ValueError( + f"Google GenAI Generate Content: no valid httpx_response " + f"(got {type(httpx_response).__name__!r}) and result is not a dict " + f"(got {type(result).__name__!r}); cannot log response" + ) result = litellm.VertexGeminiConfig()._transform_google_generate_content_to_openai_model_response( completion_response=dict_result, model_response=litellm.ModelResponse(),