mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-30 17:25:30 -05:00
[GH-ISSUE #8772] how to catch exception from a pipe to render the toast.error like in router/openai #69852
Reference in New Issue
Block a user
Originally created by @sir3mat on GitHub (Jan 22, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8772
Bug Report
Issue Description
When streaming data from a pipe to OpenWebUI, exceptions raised by the pipe are not properly captured or propagated to trigger a toast.error in the OpenWebUI chat UI. This behavior is inconsistent with the router/openai endpoint, where exceptions are properly surfaced to the UI.
Steps to Reproduce
Set up a pipe to stream data to OpenWebUI.
Raise an exception from the pipe during the streaming process.
Observe that the exception is not propagated to the UI as a toast.error notification.
Expected Behavior
The exception raised from the pipe should trigger the same toast.error behavior in the OpenWebUI chat UI as when an exception is raised from the router/openai endpoint.
Code Reference
The issue seems to occur in the following code snippet: https://github.com/open-webui/open-webui/blob/568dbc545cdd7e1d08e0db7851bace82db04a418/backend/open_webui/functions.py#L278
Observations
In router/openai, exceptions raised by the OpenAI endpoint result in a toast.error notification in the UI. However, this behavior is not observed when exceptions are raised from a pipe during streaming.
Questions
How can exceptions raised from a pipe during streaming be captured and propagated to the UI to achieve consistent behavior with the router/openai endpoint?
Are there specific mechanisms or error-handling structures that need to be implemented to ensure this behavior?