open-webui / open-webui/computer
bug: message is silently lost when sending fails (e.g. network offline)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 569
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
Problem
When sending a chat message fails (network offline, server unreachable, or a non-2xx response), the message silently disappears. The input is cleared, the optimistic user message flashes and is removed, no error is shown, and the text is gone. The only trace is an unhandled TypeError: Failed to fetch in the console.
Steps to reproduce
- Open a chat and type a message (optionally attach a file).
- Make the request fail, e.g. DevTools → Network → Offline, or stop the server.
- Press Enter.
Actual: the message appears for a moment, then vanishes; the input and attachments are empty; no toast. For a new chat the tab title keeps the first 40 characters of the lost message.
Expected: an error is shown and the message (and attachments) stay in the input so it can be re-sent.
Root cause
In ChatPanel.svelte send():
inputText = ''andchatInputEl.clearUploads()run beforeapiSendMessageis awaited.- The
catchblock only removes the optimistic message and rethrows. Nothing restores the draft and no toast is shown. ChatInputcallsonsend()without awaiting, so the rethrown error becomes an unhandled rejection and never reaches the user.- The streaming/queue branch has the same problem (its
catchonly logs).
Proposed fix
- Capture the untransformed draft text and the attached files before sending.
- On failure, restore both, reset
currentMessageId, and reset the new-chat tab label. - Replace
throw ewithtoast.error(...), matching how compact/fork failures are reported.ApiErrormessages from the server are shown as-is; other failures (network) use a newchat.sendFailedstring. - Apply the same restoration in the queue branch.
ChatInputgets a smallrestoreUploads()counterpart toclearUploads().
Deliberately minimal: no retry button or "failed" marker on the message; happy to adjust if you prefer a different UX.
Verification
Playwright (headless Chromium) against a local build, aborting POST /api/chats with internetdisconnected:
| before | after | |
|---|---|---|
| input after failed send | empty | text restored |
| toast | none | "Failed to send message" |
| new-chat tab title | first 40 chars of the lost message | "New Chat" |
| unhandled rejection | yes | no |
Additional context
Implemented on a fork (4 files, +20/-3):
https://github.com/open-webui/computer/compare/main...ebifrier:computer:fix/keep-message-on-send-failure
Related but different cause: #262 (prompt deleted when moving the window) does not involve sending.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with send() in ChatPanel.svelte and the send callback plus upload helpers in ChatInput. Reproduce the failed POST with Playwright or an offline network, then verify against the issue’s checks: the text and attachments remain available, the failure is shown, the new-chat title resets, and no unhandled rejection occurs.
Written by the indexing model from the issue text.
Assessment
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100