issue: UI freezes when querying a model with mixed-distance in knowledge base sources #6756

Closed
opened 2025-11-11 17:05:11 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @silentoplayz on GitHub (Oct 24, 2025).

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.34

Ollama Version (if applicable)

v0.12.6

Operating System

Ubuntu 24.04.3 LTS

Browser (if applicable)

Mozilla Firefox Snap for Ubuntu - v144.0 (64-bit)

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

After sending a query to the model, the UI should display the model's response in the chat window. The application should remain responsive, and no JavaScript errors should appear in the browser console.

Actual Behavior

The model fails to respond visually, and the UI becomes unresponsive (freezes). The browser console shows two JavaScript errors, preventing any further interaction with the chat interface until the page is refreshed. The chat itself should be considered dead/broken.

Steps to Reproduce

  1. Start with a clean Ubuntu 24.04.3 LTS install.

  2. Install the latest version of Docker and start the service.

  3. Run docker run -d -p 3000:8080 -e OLLAMA_BASE_URL=http://host.docker.internal:11434 --add-host=host.docker.internal:host-gateway --name open-webui ghcr.io/open-webui/open-webui:main

  4. Open your web browser and navigate to http://localhost:3000

  5. Create first account (Superadmin)

  6. Go to WorkspaceKnowledgeNew Knowledge.

  7. Name this new knowledge-base collection something like KB - Public and keep it public. Add a file to it.
    Image

  8. Create once more knowledge-base collection and name it something like KB - Private. Add a file to it and set the collection's visibility from Public (by default) to Private.
    Image

  9. Go to Admin PanelSettingsModelsEdit pencil icon for a model.

  10. Attach both KB - Public and KB - Private to the model.

  11. Click on the attached KB - Public knowledge-base collection and toggle Using Entire Document so that the toggle is set to an enabled position.## Ensure it looks EXACTLY like this (public knowledgebase shown first, private shown second)Image

Image
  1. Save & Update changes to the model.
  2. Click “New Chat” in the chat sidebar to return back to the landing page.
  3. In the model selector, select the model you've just attached the new knowledgebase collections to. Send a query to the model.
  4. The model fails to visually respond in the chat; UI becomes unresponsive (frozen); browser console shows two JS errors.
  5. Refresh the page; UI loads again, the issue is only triggered again. You will need to click on another chat in the chats sidebar and THEN refresh the page to break out of this loop (easy enough).

Logs & Screenshots

Browser Console Errors:

[HMR][Svelte] Unrecoverable HMR error in <Citations>: next update will trigger a full reload <anonymous code>:1:147461
    overrideMethod <anonymous code>:1
    logError proxy.js:15
    Proxy<Citations> proxy.js:380
    create_if_block_26 ResponseMessage.svelte:1606
    create_else_block_5 ResponseMessage.svelte:807
    create_key_block ResponseMessage.svelte:5970
    create_fragment ResponseMessage.svelte:6294
    init Component.js:148
    ResponseMessage ResponseMessage.svelte:7474
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<ResponseMessage> proxy.js:349
    create_if_block_2 Message.svelte:247
    create_if_block Message.svelte:59
    create_fragment Message.svelte:53
    init Component.js:148
    Message Message.svelte:806
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<Message> proxy.js:349
    create_each_block Messages.svelte:386
    create_key_block Messages.svelte:529
    create_else_block Messages.svelte:79
    create_fragment Messages.svelte:740
    init Component.js:148
    Messages Messages.svelte:1464
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<Messages> proxy.js:349
    create_if_block_1 Chat.svelte:792
    create_default_slot_1 Chat.svelte:1155
    create_slot utils.js:165
    create_fragment2 paneforge.js:1608
    init Component.js:148
    Pane paneforge.js:1917
    create_default_slot Chat.svelte:1284
    create_slot utils.js:165
    create_fragment paneforge.js:1239
    init Component.js:148
    Pane_group paneforge.js:1524
    create_if_block Chat.svelte:228
    update Chat.svelte:1616
    update scheduler.js:119
    flush scheduler.js:79
    (Async: promise callback)
    schedule_update scheduler.js:20
    make_dirty Component.js:81
    ctx Component.js:139
    navigateHandler Chat.svelte:1792
    update Chat.svelte:155
    init Component.js:144
    Chat Chat.svelte:4310
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<Chat> proxy.js:349
    create_fragment +page.svelte:27
    init Component.js:148
    Page +page.svelte:92
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<+page> proxy.js:349
    construct_svelte_component_dev dev.js:257
    create_else_block root.svelte:457
    create_default_slot_1 root.svelte:748
    create_slot utils.js:165
    create_if_block_2 +layout.svelte:745
    update +layout.svelte:360
    update +layout.svelte:231
    update +layout.svelte:928
    update scheduler.js:119
    flush scheduler.js:79
    (Async: promise callback)
    schedule_update scheduler.js:20
    make_dirty Component.js:81
    ctx Component.js:139
    instance +layout.svelte:1275
    run utils.js:41
    mount_component Component.js:47
    flush scheduler.js:99
    (Async: promise callback)
    schedule_update scheduler.js:20
    make_dirty Component.js:81
    ctx Component.js:139
    instance +layout.svelte:1250
    run utils.js:41
    mount_component Component.js:47
    flush scheduler.js:99
    init Component.js:164
    Root root.svelte:1332
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<Root> proxy.js:349
    initialize client.js:483
    navigate client.js:1599
    start client.js:330
    <anonymous> 42f1006d-013d-42e4-a61f-a65af18cffd2:130
    (Async: promise callback)
    <anonymous> 42f1006d-013d-42e4-a61f-a65af18cffd2:129
Uncaught (in promise) TypeError: can't access property "push", existingSource.distances is undefined
    citations Citations.svelte:104
    citations Citations.svelte:83
    update Citations.svelte:78
    init Component.js:144
    Citations Citations.svelte:931
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<Citations> proxy.js:349
### Additional Information
    create_if_block_26 ResponseMessage.svelte:1606
    create_else_block_5 ResponseMessage.svelte:807
    create_key_block ResponseMessage.svelte:5970
    create_fragment ResponseMessage.svelte:6294
    init Component.js:148
    ResponseMessage ResponseMessage.svelte:7474
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<ResponseMessage> proxy.js:349
    create_if_block_2 Message.svelte:247
    create_if_block Message.svelte:59
    create_fragment Message.svelte:53
    init Component.js:148
    Message Message.svelte:806
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<Message> proxy.js:349
    create_each_block Messages.svelte:386
    create_key_block Messages.svelte:529
    create_else_block Messages.svelte:79
    create_fragment Messages.svelte:740
    init Component.js:148
    Messages Messages.svelte:1464
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<Messages> proxy.js:349
    create_if_block_1 Chat.svelte:792
    create_default_slot_1 Chat.svelte:1155
    create_slot utils.js:165
    create_fragment2 paneforge.js:1608
    init Component.js:148
    Pane paneforge.js:1917
    create_default_slot Chat.svelte:1284
    create_slot utils.js:165
    create_fragment paneforge.js:1239
    init Component.js:148
    Pane_group paneforge.js:1524
    create_if_block Chat.svelte:228
    update Chat.svelte:1616
    update scheduler.js:119
    flush scheduler.js:79
    promise callback*schedule_update scheduler.js:20
    make_dirty Component.js:81
    ctx Component.js:139
    navigateHandler Chat.svelte:1792
    update Chat.svelte:155
    init Component.js:144
    Chat Chat.svelte:4310
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<Chat> proxy.js:349
    create_fragment +page.svelte:27
    init Component.js:148
    Page +page.svelte:92
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<+page> proxy.js:349
    construct_svelte_component_dev dev.js:257
    create_else_block root.svelte:457
    create_default_slot_1 root.svelte:748
    create_slot utils.js:165
    create_if_block_2 +layout.svelte:745
    update +layout.svelte:360
    update +layout.svelte:231
    update +layout.svelte:928
    update scheduler.js:119
    flush scheduler.js:79
    promise callback*schedule_update scheduler.js:20
    make_dirty Component.js:81
    ctx Component.js:139
    instance +layout.svelte:1275
    run utils.js:41
    mount_component Component.js:47
    flush scheduler.js:99
    promise callback*schedule_update scheduler.js:20
    make_dirty Component.js:81
    ctx Component.js:139
    instance +layout.svelte:1250
    run utils.js:41
    mount_component Component.js:47
    flush scheduler.js:99
    init Component.js:164
    Root root.svelte:1332
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<Root> proxy.js:349
    initialize client.js:483
    navigate client.js:1599
    start client.js:330
    async* 42f1006d-013d-42e4-a61f-a65af18cffd2:130
    promise callback* 42f1006d-013d-42e4-a61f-a65af18cffd2:129
Citations.svelte:104:34
    flush scheduler.js:85
    (Async: promise callback)
    schedule_update scheduler.js:20
    make_dirty Component.js:81
    ctx Component.js:139
    navigateHandler Chat.svelte:1792
    InterpretGeneratorResume self-hosted:1332
    AsyncFunctionNext self-hosted:800
    (Async: async)
    update Chat.svelte:155
    init Component.js:144
    Chat Chat.svelte:4310
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<Chat> proxy.js:349
    create_fragment +page.svelte:27
    init Component.js:148
    Page +page.svelte:92
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<+page> proxy.js:349
    construct_svelte_component_dev dev.js:257
    create_else_block root.svelte:457
    create_default_slot_1 root.svelte:748
    create_slot utils.js:165
    create_if_block_2 +layout.svelte:745
    update +layout.svelte:360
    update +layout.svelte:231
    update +layout.svelte:928
    update scheduler.js:119
    flush scheduler.js:79
    (Async: promise callback)
    schedule_update scheduler.js:20
    make_dirty Component.js:81
    ctx Component.js:139
    instance +layout.svelte:1275
    InterpretGeneratorResume self-hosted:1332
    AsyncFunctionNext self-hosted:800
    (Async: async)
    run utils.js:41
    map self-hosted:175
    mount_component Component.js:47
    flush scheduler.js:99
    (Async: promise callback)
    schedule_update scheduler.js:20
    make_dirty Component.js:81
    ctx Component.js:139
    instance +layout.svelte:1250
    InterpretGeneratorResume self-hosted:1332
    AsyncFunctionNext self-hosted:800
    (Async: async)
    run utils.js:41
    map self-hosted:175
    mount_component Component.js:47
    flush scheduler.js:99
    init Component.js:164
    Root root.svelte:1332
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<Root> proxy.js:349
    initialize client.js:483
    navigate client.js:1599
    InterpretGeneratorResume self-hosted:1332
    AsyncFunctionNext self-hosted:800
    (Async: async)
    start client.js:330
    InterpretGeneratorResume self-hosted:1332
    AsyncFunctionNext self-hosted:800
    (Async: async)
    <anonymous> 42f1006d-013d-42e4-a61f-a65af18cffd2:130
    (Async: promise callback)
    <anonymous> 42f1006d-013d-42e4-a61f-a65af18cffd2:129
Image

Additional Information

  • Extensive testing has revealed a specific set of conditions under which this bug can be consistently reproduced. The issue is triggered when a model is configured with two knowledge bases in a specific way:
    1. A Public knowledge base that has the Using Entire Document setting enabled at the model level.
    2. A Private knowledge base attached normally (without that setting enabled).
  • The underlying technical reason is that the Using Entire Document setting provides document content without a distance (relevance) score, while the standard retrieval method does. This creates a mix of citation sources—some with distance scores and some without—which exposed the initialization bug in the frontend.
  • This behavior is reproducible on a single superadmin account with access to both knowledge bases and has been observed across different model types (base, workspace, local, and external).

Agentic AI analysis

The root cause of this bug lies in the Citations.svelte component. When processing citation sources, the code attempts to push a distance value to an existingSource.distances array. However, the distances array is initialized as undefined if the first document processed for a given source does not have a distance value.

When a subsequent document for the same source does have a distance value, the code tries to call .push() on undefined, triggering a TypeError that freezes the UI.

File: src/lib/components/chat/Messages/Citations.svelte

Problematic Code:

if (existingSource) {
  existingSource.document.push(document);
  existingSource.metadata.push(metadata);
  if (distance !== undefined) existingSource.distances.push(distance); // This line fails
} else {
  acc.push({
    id: id,
    source: _source,
    document: [document],
    metadata: metadata ? [metadata] : [],
    distances: distance !== undefined ? [distance] : undefined // This is the root cause
  });
}

When a source is first encountered, distances is set to undefined if distance is not present. If a later document for the same source does have a distance, the existingSource.distances.push(distance) line will fail.

Suggested Fix:
Initialize distances as an empty array [] instead of undefined when a new source is added to the accumulator.

// In the `else` block
distances: distance !== undefined ? [distance] : []
Originally created by @silentoplayz on GitHub (Oct 24, 2025). ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.34 ### Ollama Version (if applicable) v0.12.6 ### Operating System Ubuntu 24.04.3 LTS ### Browser (if applicable) Mozilla Firefox Snap for Ubuntu - v144.0 (64-bit) ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior After sending a query to the model, the UI should display the model's response in the chat window. The application should remain responsive, and no JavaScript errors should appear in the browser console. ### Actual Behavior The model fails to respond visually, and the UI becomes unresponsive (freezes). The browser console shows two JavaScript errors, preventing any further interaction with the chat interface until the page is refreshed. The chat itself should be considered dead/broken. ### Steps to Reproduce 1. Start with a clean Ubuntu 24.04.3 LTS install. 2. Install the latest version of Docker and start the service. 3. Run `docker run -d -p 3000:8080 -e OLLAMA_BASE_URL=http://host.docker.internal:11434 --add-host=host.docker.internal:host-gateway --name open-webui ghcr.io/open-webui/open-webui:main` 4. Open your web browser and navigate to http://localhost:3000 5. Create first account (Superadmin) 6. Go to `Workspace` → `Knowledge` → `New Knowledge`. 7. Name this new knowledge-base collection something like `KB - Public` and keep it public. Add a file to it. <img width="2311" height="650" alt="Image" src="https://github.com/user-attachments/assets/e6aedfb5-ac66-49d6-a1a4-855e44be3cef" /> 8. Create once more knowledge-base collection and name it something like `KB - Private`. Add a file to it and set the collection's visibility from `Public` (by default) to `Private`. <img width="2311" height="650" alt="Image" src="https://github.com/user-attachments/assets/28292b18-9ad7-4caa-961f-ecb9e6a01e3b" /> 9. Go to `Admin Panel` → `Settings` → `Models` → `Edit pencil icon for a model`. 10. Attach both `KB - Public` and `KB - Private` to the model. 11. Click on the attached `KB - Public` knowledge-base collection and toggle `Using Entire Document` so that the toggle is set to an enabled position.## Ensure it looks **EXACTLY** like this (public knowledgebase shown first, private shown second)<img width="1641" height="850" alt="Image" src="https://github.com/user-attachments/assets/11dd9ed1-7d4f-450b-bf3a-8172d4478121" /> <img width="1641" height="850" alt="Image" src="https://github.com/user-attachments/assets/b019a587-0690-4786-936b-19629dd71d47" /> 12. `Save & Update` changes to the model. 13. Click “New Chat” in the chat sidebar to return back to the landing page. 14. In the model selector, select the model you've just attached the new knowledgebase collections to. Send a query to the model. 15. The model fails to visually respond in the chat; UI becomes unresponsive (frozen); browser console shows two JS errors. 16. Refresh the page; UI loads again, the issue is only triggered again. You will need to click on another chat in the chats sidebar and **THEN** refresh the page to break out of this loop (easy enough). ### Logs & Screenshots **Browser Console Errors:** ```js [HMR][Svelte] Unrecoverable HMR error in <Citations>: next update will trigger a full reload <anonymous code>:1:147461 overrideMethod <anonymous code>:1 logError proxy.js:15 Proxy<Citations> proxy.js:380 create_if_block_26 ResponseMessage.svelte:1606 create_else_block_5 ResponseMessage.svelte:807 create_key_block ResponseMessage.svelte:5970 create_fragment ResponseMessage.svelte:6294 init Component.js:148 ResponseMessage ResponseMessage.svelte:7474 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<ResponseMessage> proxy.js:349 create_if_block_2 Message.svelte:247 create_if_block Message.svelte:59 create_fragment Message.svelte:53 init Component.js:148 Message Message.svelte:806 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<Message> proxy.js:349 create_each_block Messages.svelte:386 create_key_block Messages.svelte:529 create_else_block Messages.svelte:79 create_fragment Messages.svelte:740 init Component.js:148 Messages Messages.svelte:1464 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<Messages> proxy.js:349 create_if_block_1 Chat.svelte:792 create_default_slot_1 Chat.svelte:1155 create_slot utils.js:165 create_fragment2 paneforge.js:1608 init Component.js:148 Pane paneforge.js:1917 create_default_slot Chat.svelte:1284 create_slot utils.js:165 create_fragment paneforge.js:1239 init Component.js:148 Pane_group paneforge.js:1524 create_if_block Chat.svelte:228 update Chat.svelte:1616 update scheduler.js:119 flush scheduler.js:79 (Async: promise callback) schedule_update scheduler.js:20 make_dirty Component.js:81 ctx Component.js:139 navigateHandler Chat.svelte:1792 update Chat.svelte:155 init Component.js:144 Chat Chat.svelte:4310 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<Chat> proxy.js:349 create_fragment +page.svelte:27 init Component.js:148 Page +page.svelte:92 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<+page> proxy.js:349 construct_svelte_component_dev dev.js:257 create_else_block root.svelte:457 create_default_slot_1 root.svelte:748 create_slot utils.js:165 create_if_block_2 +layout.svelte:745 update +layout.svelte:360 update +layout.svelte:231 update +layout.svelte:928 update scheduler.js:119 flush scheduler.js:79 (Async: promise callback) schedule_update scheduler.js:20 make_dirty Component.js:81 ctx Component.js:139 instance +layout.svelte:1275 run utils.js:41 mount_component Component.js:47 flush scheduler.js:99 (Async: promise callback) schedule_update scheduler.js:20 make_dirty Component.js:81 ctx Component.js:139 instance +layout.svelte:1250 run utils.js:41 mount_component Component.js:47 flush scheduler.js:99 init Component.js:164 Root root.svelte:1332 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<Root> proxy.js:349 initialize client.js:483 navigate client.js:1599 start client.js:330 <anonymous> 42f1006d-013d-42e4-a61f-a65af18cffd2:130 (Async: promise callback) <anonymous> 42f1006d-013d-42e4-a61f-a65af18cffd2:129 ``` ```js Uncaught (in promise) TypeError: can't access property "push", existingSource.distances is undefined citations Citations.svelte:104 citations Citations.svelte:83 update Citations.svelte:78 init Component.js:144 Citations Citations.svelte:931 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<Citations> proxy.js:349 ### Additional Information create_if_block_26 ResponseMessage.svelte:1606 create_else_block_5 ResponseMessage.svelte:807 create_key_block ResponseMessage.svelte:5970 create_fragment ResponseMessage.svelte:6294 init Component.js:148 ResponseMessage ResponseMessage.svelte:7474 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<ResponseMessage> proxy.js:349 create_if_block_2 Message.svelte:247 create_if_block Message.svelte:59 create_fragment Message.svelte:53 init Component.js:148 Message Message.svelte:806 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<Message> proxy.js:349 create_each_block Messages.svelte:386 create_key_block Messages.svelte:529 create_else_block Messages.svelte:79 create_fragment Messages.svelte:740 init Component.js:148 Messages Messages.svelte:1464 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<Messages> proxy.js:349 create_if_block_1 Chat.svelte:792 create_default_slot_1 Chat.svelte:1155 create_slot utils.js:165 create_fragment2 paneforge.js:1608 init Component.js:148 Pane paneforge.js:1917 create_default_slot Chat.svelte:1284 create_slot utils.js:165 create_fragment paneforge.js:1239 init Component.js:148 Pane_group paneforge.js:1524 create_if_block Chat.svelte:228 update Chat.svelte:1616 update scheduler.js:119 flush scheduler.js:79 promise callback*schedule_update scheduler.js:20 make_dirty Component.js:81 ctx Component.js:139 navigateHandler Chat.svelte:1792 update Chat.svelte:155 init Component.js:144 Chat Chat.svelte:4310 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<Chat> proxy.js:349 create_fragment +page.svelte:27 init Component.js:148 Page +page.svelte:92 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<+page> proxy.js:349 construct_svelte_component_dev dev.js:257 create_else_block root.svelte:457 create_default_slot_1 root.svelte:748 create_slot utils.js:165 create_if_block_2 +layout.svelte:745 update +layout.svelte:360 update +layout.svelte:231 update +layout.svelte:928 update scheduler.js:119 flush scheduler.js:79 promise callback*schedule_update scheduler.js:20 make_dirty Component.js:81 ctx Component.js:139 instance +layout.svelte:1275 run utils.js:41 mount_component Component.js:47 flush scheduler.js:99 promise callback*schedule_update scheduler.js:20 make_dirty Component.js:81 ctx Component.js:139 instance +layout.svelte:1250 run utils.js:41 mount_component Component.js:47 flush scheduler.js:99 init Component.js:164 Root root.svelte:1332 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<Root> proxy.js:349 initialize client.js:483 navigate client.js:1599 start client.js:330 async* 42f1006d-013d-42e4-a61f-a65af18cffd2:130 promise callback* 42f1006d-013d-42e4-a61f-a65af18cffd2:129 Citations.svelte:104:34 flush scheduler.js:85 (Async: promise callback) schedule_update scheduler.js:20 make_dirty Component.js:81 ctx Component.js:139 navigateHandler Chat.svelte:1792 InterpretGeneratorResume self-hosted:1332 AsyncFunctionNext self-hosted:800 (Async: async) update Chat.svelte:155 init Component.js:144 Chat Chat.svelte:4310 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<Chat> proxy.js:349 create_fragment +page.svelte:27 init Component.js:148 Page +page.svelte:92 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<+page> proxy.js:349 construct_svelte_component_dev dev.js:257 create_else_block root.svelte:457 create_default_slot_1 root.svelte:748 create_slot utils.js:165 create_if_block_2 +layout.svelte:745 update +layout.svelte:360 update +layout.svelte:231 update +layout.svelte:928 update scheduler.js:119 flush scheduler.js:79 (Async: promise callback) schedule_update scheduler.js:20 make_dirty Component.js:81 ctx Component.js:139 instance +layout.svelte:1275 InterpretGeneratorResume self-hosted:1332 AsyncFunctionNext self-hosted:800 (Async: async) run utils.js:41 map self-hosted:175 mount_component Component.js:47 flush scheduler.js:99 (Async: promise callback) schedule_update scheduler.js:20 make_dirty Component.js:81 ctx Component.js:139 instance +layout.svelte:1250 InterpretGeneratorResume self-hosted:1332 AsyncFunctionNext self-hosted:800 (Async: async) run utils.js:41 map self-hosted:175 mount_component Component.js:47 flush scheduler.js:99 init Component.js:164 Root root.svelte:1332 createProxiedComponent svelte-hooks.js:341 ProxyComponent proxy.js:242 Proxy<Root> proxy.js:349 initialize client.js:483 navigate client.js:1599 InterpretGeneratorResume self-hosted:1332 AsyncFunctionNext self-hosted:800 (Async: async) start client.js:330 InterpretGeneratorResume self-hosted:1332 AsyncFunctionNext self-hosted:800 (Async: async) <anonymous> 42f1006d-013d-42e4-a61f-a65af18cffd2:130 (Async: promise callback) <anonymous> 42f1006d-013d-42e4-a61f-a65af18cffd2:129 ``` <img width="2559" height="1440" alt="Image" src="https://github.com/user-attachments/assets/e23a5897-2fb6-4561-bba0-049b383a1f0f" /> ### Additional Information - Extensive testing has revealed a specific set of conditions under which this bug can be consistently reproduced. The issue is triggered when a model is configured with two knowledge bases in a specific way: 1. A **Public** knowledge base that has the `Using Entire Document` setting enabled at the model level. 2. A **Private** knowledge base attached normally (without that setting enabled). - The underlying technical reason is that the `Using Entire Document` setting provides document content without a `distance` (relevance) score, while the standard retrieval method does. This creates a mix of citation sources—some with distance scores and some without—which exposed the initialization bug in the frontend. - This behavior is reproducible on a single superadmin account with access to both knowledge bases and has been observed across different model types (base, workspace, local, and external). ### Agentic AI analysis The root cause of this bug lies in the `Citations.svelte` component. When processing citation sources, the code attempts to push a `distance` value to an `existingSource.distances` array. However, the `distances` array is initialized as `undefined` if the first document processed for a given source does not have a `distance` value. When a subsequent document for the same source *does* have a `distance` value, the code tries to call `.push()` on `undefined`, triggering a `TypeError` that freezes the UI. **File:** `src/lib/components/chat/Messages/Citations.svelte` **Problematic Code:** ```javascript if (existingSource) { existingSource.document.push(document); existingSource.metadata.push(metadata); if (distance !== undefined) existingSource.distances.push(distance); // This line fails } else { acc.push({ id: id, source: _source, document: [document], metadata: metadata ? [metadata] : [], distances: distance !== undefined ? [distance] : undefined // This is the root cause }); } ``` When a source is first encountered, `distances` is set to `undefined` if `distance` is not present. If a later document for the same source *does* have a `distance`, the `existingSource.distances.push(distance)` line will fail. **Suggested Fix:** Initialize `distances` as an empty array `[]` instead of `undefined` when a new source is added to the accumulator. ```javascript // In the `else` block distances: distance !== undefined ? [distance] : [] ```
GiteaMirror added the testing wantedbug labels 2025-11-11 17:05:11 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#6756