From b91e8b73ab820819310c91d566344486a0b45e42 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 31 Dec 2025 14:38:47 +0100 Subject: [PATCH] fix: properly raise exceptions instead of returning them in chat.py (#20276) Change 'return Exception(...)' to 'raise Exception(...)' in chat_completed() and chat_action() functions. Returning an exception object instead of raising it causes errors to be silently swallowed, breaking error propagation. --- backend/open_webui/utils/chat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/utils/chat.py b/backend/open_webui/utils/chat.py index e8ebf845d..6877186e3 100644 --- a/backend/open_webui/utils/chat.py +++ b/backend/open_webui/utils/chat.py @@ -310,7 +310,7 @@ async def chat_completed(request: Request, form_data: dict, user: Any): try: data = await process_pipeline_outlet_filter(request, data, user, models) except Exception as e: - return Exception(f"Error: {e}") + raise Exception(f"Error: {e}") metadata = { "chat_id": data["chat_id"], @@ -346,7 +346,7 @@ async def chat_completed(request: Request, form_data: dict, user: Any): ) return result except Exception as e: - return Exception(f"Error: {e}") + raise Exception(f"Error: {e}") async def chat_action(request: Request, action_id: str, form_data: dict, user: Any): @@ -442,6 +442,6 @@ async def chat_action(request: Request, action_id: str, form_data: dict, user: A data = action(**params) except Exception as e: - return Exception(f"Error: {e}") + raise Exception(f"Error: {e}") return data