From e771f3eb7557ed2d78e5e82cc70702694bbd887a Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 30 Nov 2026 21:04:41 +0100 Subject: [PATCH] fix: tool call through Tether hangs forever when the response is over 16 MiB (#35392) When a tool on a computer connected through Tether returned more than 16 MiB, for example a large image, the tool call spun in the chat forever and the model never got an answer. Open WebUI rejected the oversized response and then tried to read it a second time, waiting for data that would never come. The tool call now fails right away with the "Response too large to buffer" error, which the model gets as the tool result. Fixes #35207 --- backend/open_webui/utils/tether.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/tether.py b/backend/open_webui/utils/tether.py index 4e407283b6..8742da3f67 100644 --- a/backend/open_webui/utils/tether.py +++ b/backend/open_webui/utils/tether.py @@ -630,6 +630,7 @@ class RelayResponse: self.content_type = self.headers.get('Content-Type', '').split(';')[0] self.content = self self.cached = None + self.error = None self.closed = False async def iter_any(self): @@ -651,13 +652,17 @@ class RelayResponse: yield data, False async def read(self): + # The stream is closed, so a second read would wait forever. + if self.error: + raise self.error if self.cached is None: parts, size = [], 0 async for data in self.iter_any(): size += len(data) if size > MAX_MESSAGE: await self.close() - raise HTTPException(413, 'Response too large to buffer; use streaming.') + self.error = HTTPException(413, 'Response too large to buffer; use streaming.') + raise self.error parts.append(data) self.cached = b''.join(parts) return self.cached