From 668bd44485bdf88e9083c6f09c3c47ab97a128a4 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 28 Feb 2026 20:22:24 -0600 Subject: [PATCH] refac --- backend/open_webui/utils/middleware.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index be83db29b..aed38ce02 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -4135,6 +4135,13 @@ async def streaming_chat_response_handler(response, ctx): log.error( f"Error parsing tool call arguments: {tool_args}" ) + results.append( + { + "tool_call_id": tool_call_id, + "content": f"Error: Tool call arguments could not be parsed. The model generated malformed or incomplete JSON for `{tool_function_name}`. Please try again.", + } + ) + continue # Ensure arguments are valid JSON for downstream LLM integrations log.debug(