mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 06:03:26 -05:00
[GH-ISSUE #8772] how to catch exception from a pipe to render the toast.error like in router/openai #53914
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
568dbc545c/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?