From 06ff3f9195b09cccd857d15862b5865133bd453d Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sun, 8 Nov 2026 02:53:50 +0100 Subject: [PATCH] fix: a malformed tool call with Tool Search on ends tool use for the rest of the reply (#33872) With Tool Search on, when the model sent a broken call for a tool Tool Search had not loaded yet (arguments that were not a JSON object, or a list of tool calls that was empty or in the wrong format), Open WebUI handled it like an unfinished model response and the rest of the reply ran without any tools. Now the model gets a tool error back, like it does for an unknown tool name, and can retry with its tools. Only a model response that really was cut off still ends tool use. Fixes #33871 --- backend/open_webui/utils/middleware.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 09efd085de..7f99592f44 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -5854,7 +5854,10 @@ async def streaming_chat_response_handler(response, ctx): else f'Error: Tool "{item["name"]}" not found.' ) blocked = tool_repetition_error(item, tool_history) - stop_reason = stop_reason or round_error or blocked or tool_call.get('execution_error') + is_incomplete = tool_call.get('execution_error') == INCOMPLETE_CALL_ERROR + stop_reason = ( + stop_reason or round_error or blocked or (INCOMPLETE_CALL_ERROR if is_incomplete else None) + ) error = f'Error: {round_error}' if round_error else error or blocked if error: tool_history.append(item)