mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-11 18:43:44 -05:00
[GH-ISSUE #8636] The UI stop working after invalid parameter passed to toast.error() #102196
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 @weixu365 on GitHub (Jan 16, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8636
Bug Report
The UI freezes and stops working until a page refreshes when a wrong parameter is passed to toast.error() method. This might related to #1611.
Installation Method
I can reproduce the issue in either
git clone locallyor using the docker image in AWS ECSEnvironment
Confirmation:
Expected Behavior:
Show error message on error, and the UI shouldn't be frozen.
Actual Behavior:
The UI gets frozen, and nothing works until a page refresh
Description
Bug Summary:
The
toast.error(message: string | ComponentType)function doesn't support using exception as the parameterhttps://github.com/wobsoriano/svelte-sonner/blob/main/src/lib/Toast.svelte#L393-L398
If the parameter is an exception
toast.error(error), svelte-sonner.Toast assumes it's a ComponentType, which raise the following error. The UI get freezed and stop working until a page refresh. This might related to https://github.com/open-webui/open-webui/issues/1611.Reproduction Details
Steps to Reproduce:
To reproduce the issue, you can throw an exception in any place that using toast.error(), to trigger this toast.error
throw an exception in: https://github.com/open-webui/open-webui/blob/main/src/lib/apis/index.ts#L64-L66
Potential solutions to fix
To fix the issue, pass the string error message to toast.error(), then the UI behaviours as expected
Pass error with a prefix for better readability:

toast.error(`Failed to request /chat/completed api: ${error}`)Simply use

toast.error(`${error}`)Using
toast.error(JSON.stringify(error))This is used in the existing code, and the result is not good
4269df041f/src/lib/components/chat/Chat.svelte (L578)@weixu365 commented on GitHub (Jan 16, 2025):
handleOpenAIError assuming the parameters are string: https://github.com/open-webui/open-webui/blob/main/src/lib/components/chat/Chat.svelte#L1591-L1605
Also suggest always convert to string, e.g.
toast.error(`${innerError.detail}`);@weixu365 commented on GitHub (Jan 16, 2025):
If you fine with the
toast.error(`${error}`)approach, need to find and replace the following:@weixu365 commented on GitHub (Jan 17, 2025):
The same applies to
4269df041f/src/lib/components/chat/Chat.svelte (L832-L837)The Error component is using JSON.stringify which shows
{}4269df041f/src/lib/components/chat/Messages/Error.svelte (L13)The simplest fix is:
@tjbck commented on GitHub (Jan 21, 2025):
Should be semi-addressed with a863f98c533e1325a106ab98480045c8a376af89!