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)