From cac5dd12e9037a3e8d09e029159ffb120a513dcf Mon Sep 17 00:00:00 2001 From: G30 <50341825+silentoplayz@users.noreply.github.com> Date: Thu, 5 Feb 2026 15:15:34 -0500 Subject: [PATCH] fix: handle null data in model_response_handler (#21112) Fix `AttributeError` in `model_response_handler` when processing channel messages with `null` data field. The function iterates over thread messages to build conversation history, but some messages may have `data=None` causing a crash when accessing `thread_message.data.get()`. Added null check using `(thread_message.data or {}).get("files", [])` to safely handle messages without data. --- backend/open_webui/routers/channels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/routers/channels.py b/backend/open_webui/routers/channels.py index e463276589..2c94ddd91f 100644 --- a/backend/open_webui/routers/channels.py +++ b/backend/open_webui/routers/channels.py @@ -1065,7 +1065,7 @@ async def model_response_handler(request, channel, message, user, db=None): f"{username}: {replace_mentions(thread_message.content)}" ) - thread_message_files = thread_message.data.get("files", []) + thread_message_files = (thread_message.data or {}).get("files", []) for file in thread_message_files: if file.get("type", "") == "image": images.append(file.get("url", ""))