[GH-ISSUE #24424] Chat stuck on Loading after failed message regeneration #107291

Closed
opened 2026-05-18 06:02:22 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @bernadinm on GitHub (May 6, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24424

Description

When an API response fails mid-stream during message regeneration (e.g., connection timeout), the chat can become permanently stuck showing "Loading..." and never renders.

Root Cause

Failed regeneration attempts leave orphaned entries in the chat data structure:

  1. history.messages accumulates entries for failed regeneration attempts that never complete
  2. currentId can end up pointing to a message ID that doesn't exist in the messages array
  3. childrenIds arrays reference non-existent message IDs
  4. The frontend doesn't validate these references and hangs trying to render a broken message tree

Steps to Reproduce

  1. Open a chat and send a message
  2. Receive a response from an AI model
  3. Attempt to regenerate the response multiple times while the API is failing (e.g., connection timeouts, 503 errors)
  4. After several failed regenerations, the chat becomes stuck on "Loading..."

Example of Corrupted State

history.messages: 9 entries (including 5 orphaned from failed regenerations)
messages array: 4 entries (the actual valid messages)
currentId: pointing to an orphaned message ID not in messages array

Suggested Fix

  1. When a response generation fails, clean up the partially created message entry from history.messages
  2. Validate currentId exists in messages array before rendering
  3. Add frontend error handling to detect orphaned references and either auto-repair or show a recoverable error instead of infinite loading
  4. Consider adding a database migration or health check to detect and repair corrupted chats

Workaround

Manually clean up the SQLite database:

  • Remove orphaned entries from history.messages that don't exist in messages array
  • Fix currentId to point to a valid message
  • Clean up invalid childrenIds references

Environment

  • Open WebUI version: 0.8.12
  • API: Google GenAI (Gemini) via pipelines
  • Failure mode: Connection timeout during streaming response
Originally created by @bernadinm on GitHub (May 6, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/24424 ## Description When an API response fails mid-stream during message regeneration (e.g., connection timeout), the chat can become permanently stuck showing "Loading..." and never renders. ## Root Cause Failed regeneration attempts leave orphaned entries in the chat data structure: 1. `history.messages` accumulates entries for failed regeneration attempts that never complete 2. `currentId` can end up pointing to a message ID that doesn't exist in the `messages` array 3. `childrenIds` arrays reference non-existent message IDs 4. The frontend doesn't validate these references and hangs trying to render a broken message tree ## Steps to Reproduce 1. Open a chat and send a message 2. Receive a response from an AI model 3. Attempt to regenerate the response multiple times while the API is failing (e.g., connection timeouts, 503 errors) 4. After several failed regenerations, the chat becomes stuck on "Loading..." ## Example of Corrupted State ``` history.messages: 9 entries (including 5 orphaned from failed regenerations) messages array: 4 entries (the actual valid messages) currentId: pointing to an orphaned message ID not in messages array ``` ## Suggested Fix 1. When a response generation fails, clean up the partially created message entry from `history.messages` 2. Validate `currentId` exists in `messages` array before rendering 3. Add frontend error handling to detect orphaned references and either auto-repair or show a recoverable error instead of infinite loading 4. Consider adding a database migration or health check to detect and repair corrupted chats ## Workaround Manually clean up the SQLite database: - Remove orphaned entries from `history.messages` that don't exist in `messages` array - Fix `currentId` to point to a valid message - Clean up invalid `childrenIds` references ## Environment - Open WebUI version: 0.8.12 - API: Google GenAI (Gemini) via pipelines - Failure mode: Connection timeout during streaming response
Author
Owner

@owui-terminator[bot] commented on GitHub (May 6, 2026):

⚠️ Missing Issue Title Prefix

@bernadinm, your issue title is missing a categorising prefix (e.g. bug:, feat:, docs:).

Please update the title to lead with one of:

  • bug: bug report or error
  • feat: feature request or enhancement
  • docs: documentation issue
  • question: usage question
  • help: support request

Example: bug: Login fails when the password contains special characters

<!-- gh-comment-id:4392641735 --> @owui-terminator[bot] commented on GitHub (May 6, 2026): # ⚠️ Missing Issue Title Prefix @bernadinm, your issue title is missing a categorising prefix (e.g. `bug:`, `feat:`, `docs:`). Please update the title to lead with one of: - **bug**: bug report or error - **feat**: feature request or enhancement - **docs**: documentation issue - **question**: usage question - **help**: support request Example: `bug: Login fails when the password contains special characters`
Author
Owner

@owui-terminator[bot] commented on GitHub (May 6, 2026):

🔍 Related Issues Found

I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions:

  1. 🟢 #24157 issue: Chat stuck in infinite Loading when history.currentId points to a malformed provider response object after safety rejection
    Very similar failure mode: the chat gets stuck in infinite loading because history.currentId points to an invalid message object. Your issue also involves broken chat-tree references causing the frontend to hang.
    by mcxiaochenn · bug

  2. 🟣 #20474 Chat infinitely loads when history.currentId points to orphaned/deleted message
    This is the closest match: it reports infinite loading when history.currentId points to an orphaned/deleted message. Your issue describes orphaned entries and invalid currentId after failed regenerations, which is the same class of corruption.
    by MacJedi42 · bug

  3. 🟢 #15189 issue: Bug: Lack of Data Integrity Validation on Chat Model Causes Silent Failure and Frontend Deadlock
    Broader but clearly related data-integrity issue. It describes malformed chat structure causing frontend deadlock/infinite loading, matching your root cause of broken message-tree integrity.
    by robotmikhro · bug, confirmed issue

  4. 🟣 #20825 Chat becomes permanently stuck loading after cancelling a streaming response from suggested prompts
    Related because cancellation during streaming leaves an orphaned message and history.currentId pointing to it, which then causes the chat to stick loading forever. While triggered by cancel rather than regen failure, the underlying broken tree state is highly similar.
    by bernadinm


💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.

This comment was generated automatically. React with 👍 if helpful, 👎 if not.

<!-- gh-comment-id:4392642506 --> @owui-terminator[bot] commented on GitHub (May 6, 2026): <!-- terminator-bot:related-issues-reply --> 🔍 **Related Issues Found** I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions: 1. 🟢 [#24157](https://github.com/open-webui/open-webui/issues/24157) **issue: Chat stuck in infinite Loading when history.currentId points to a malformed provider response object after safety rejection** *Very similar failure mode: the chat gets stuck in infinite loading because `history.currentId` points to an invalid message object. Your issue also involves broken chat-tree references causing the frontend to hang.* *by mcxiaochenn · `bug`* 2. 🟣 [#20474](https://github.com/open-webui/open-webui/issues/20474) **Chat infinitely loads when history.currentId points to orphaned/deleted message** *This is the closest match: it reports infinite loading when `history.currentId` points to an orphaned/deleted message. Your issue describes orphaned entries and invalid `currentId` after failed regenerations, which is the same class of corruption.* *by MacJedi42 · `bug`* 3. 🟢 [#15189](https://github.com/open-webui/open-webui/issues/15189) **issue: Bug: Lack of Data Integrity Validation on Chat Model Causes Silent Failure and Frontend Deadlock** *Broader but clearly related data-integrity issue. It describes malformed chat structure causing frontend deadlock/infinite loading, matching your root cause of broken message-tree integrity.* *by robotmikhro · `bug`, `confirmed issue`* 4. 🟣 [#20825](https://github.com/open-webui/open-webui/issues/20825) **Chat becomes permanently stuck loading after cancelling a streaming response from suggested prompts** *Related because cancellation during streaming leaves an orphaned message and `history.currentId` pointing to it, which then causes the chat to stick loading forever. While triggered by cancel rather than regen failure, the underlying broken tree state is highly similar.* *by bernadinm* --- 💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead. *This comment was generated automatically.* React with 👍 if helpful, 👎 if not.
Author
Owner

@tjbck commented on GitHub (May 8, 2026):

Likely addressed with the latest dev.

<!-- gh-comment-id:4409977645 --> @tjbck commented on GitHub (May 8, 2026): Likely addressed with the latest dev.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#107291