From 752e755da5b0e5b2404435b91f3f9af6d929e81b Mon Sep 17 00:00:00 2001 From: sclfcz Date: Sat, 26 Sep 2026 09:08:03 +0800 Subject: [PATCH] fix(llm_response_utils): actually widen the except clause The earlier commit added the rationale comment but the clause still read json.JSONDecodeError alone, so the four malformed payloads kept escaping. --- .../llm_response_utils/convert_dict_to_response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py b/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py index ff624a3de8b..5395ba973d3 100644 --- a/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py +++ b/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py @@ -413,7 +413,7 @@ def _handle_invalid_parallel_tool_calls( shift += len(replacement) - 1 return tool_calls - except json.JSONDecodeError: + except (json.JSONDecodeError, KeyError, TypeError, AttributeError): # if there is a JSONDecodeError, return the original tool_calls return tool_calls