[GH-ISSUE #21656] issue: RangeError when pressing Enter in chat #35078

Closed
opened 2026-04-25 09:16:39 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @m1g32 on GitHub (Feb 20, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21656

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.7.2

Ollama Version (if applicable)

No response

Operating System

kubernetes 1.32

Browser (if applicable)

No response

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

A proper response is generated and no error shown after sending a new message in a chat.

Actual Behavior

No actual response is shown in the chat, only an error with the model-name. This only happens rarely and seemingly random.
The application shows an "Uncaught RangeError: There is no position before the top-level node" in the console.

Image

Steps to Reproduce

  1. Start a new chat
  2. Write a message and press enter to send it
  3. Keep repeating this as the error will appear only rarely, seemingly random

Logs & Screenshots

Console Error
index.js:884 Uncaught RangeError: There is no position before the top-level node
at Dr.before (index.js:884:19)
at keydown (RichTextInput.svelte:951:33)
at index.js:3108:26
at mg.someProp (index.js:5502:42)
at ll (index.js:3106:17)
at Lm.n.dom.addEventListener.n.input.eventHandlers. (index.js:3075:53)


issue in RichTextInput.svelte:

function isInside(nodeTypes: string[]): boolean {
    let currentNode = $head;
    while (currentNode) {
        if (nodeTypes.includes(currentNode.parent.type.name)) {
            return true;
        }
        if (!currentNode.depth) break; // Stop if we reach the top
        currentNode = state.doc.resolve(currentNode.before()); // Line 951 - ERROR HERE
    }
    return false;
}

-> possible Fix?

function isInside(nodeTypes: string[]): boolean {
    let currentNode = $head;
    while (currentNode.depth > 0) { // Check depth BEFORE trying to move up
        if (nodeTypes.includes(currentNode.parent.type.name)) {
            return true;
        }
        currentNode = state.doc.resolve(currentNode.before());
    }
    return false;
}

Additional Information

I would really appreciate help with fixing this problem and not being closed as not reproducible. 😢

Originally created by @m1g32 on GitHub (Feb 20, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/21656 ### 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 have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.7.2 ### Ollama Version (if applicable) _No response_ ### Operating System kubernetes 1.32 ### Browser (if applicable) _No response_ ### 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 A proper response is generated and no error shown after sending a new message in a chat. ### Actual Behavior No actual response is shown in the chat, only an error with the model-name. This only happens rarely and seemingly random. The application shows an "Uncaught RangeError: There is no position before the top-level node" in the console. <img width="527" height="180" alt="Image" src="https://github.com/user-attachments/assets/0422f478-7b9a-4915-a353-a191325b5f89" /> ### Steps to Reproduce 1. Start a new chat 2. Write a message and press enter to send it 3. Keep repeating this as the error will appear only rarely, seemingly random ### Logs & Screenshots Console Error index.js:884 Uncaught RangeError: There is no position before the top-level node at Dr.before (index.js:884:19) at keydown (RichTextInput.svelte:951:33) at index.js:3108:26 at mg.someProp (index.js:5502:42) at ll (index.js:3106:17) at Lm.n.dom.addEventListener.n.input.eventHandlers.<computed> (index.js:3075:53) --- issue in RichTextInput.svelte: ```js function isInside(nodeTypes: string[]): boolean { let currentNode = $head; while (currentNode) { if (nodeTypes.includes(currentNode.parent.type.name)) { return true; } if (!currentNode.depth) break; // Stop if we reach the top currentNode = state.doc.resolve(currentNode.before()); // Line 951 - ERROR HERE } return false; } ``` -> possible Fix? ```js function isInside(nodeTypes: string[]): boolean { let currentNode = $head; while (currentNode.depth > 0) { // Check depth BEFORE trying to move up if (nodeTypes.includes(currentNode.parent.type.name)) { return true; } currentNode = state.doc.resolve(currentNode.before()); } return false; } ``` ### Additional Information I would really appreciate help with fixing this problem and not being closed as not reproducible. 😢
GiteaMirror added the bug label 2026-04-25 09:16:39 -05:00
Author
Owner

@Classic298 commented on GitHub (Feb 20, 2026):

try the latest version, you are on a 2 months old version - and sorry, i cannot reproduce with these steps to reproduce. Nor have I ever encountered this on any setup i work with

I would really appreciate help with fixing this problem and not being closed as not reproducible. 😢

Sorry. Try the latest version first.

<!-- gh-comment-id:3936164977 --> @Classic298 commented on GitHub (Feb 20, 2026): try the latest version, you are on a 2 months old version - and sorry, i cannot reproduce with these steps to reproduce. Nor have I ever encountered this on any setup i work with > I would really appreciate help with fixing this problem and not being closed as not reproducible. 😢 Sorry. Try the latest version first.
Author
Owner

@Classic298 commented on GitHub (Feb 20, 2026):

RichTextInput's isInside() is just about cursor position when pressing Enter. It has nothing to do with why a response failed or how the error gets displayed.

You saw the RangeError in console and the model error toast, and assumed they were the same bug. They're not even in the same layer of the stack.

The error parsing in handleOpenAIError tries a few known shapes, FastAPI's detail, OpenAI's error.message, then plain message. And if none match it just stringifies the whole thing. So if the upstream returns an error response in an unexpected format, it'll just dump the raw object.

Any backend logs would help here because this is most certainly an upstream error.

But first try a newer version.

<!-- gh-comment-id:3936211402 --> @Classic298 commented on GitHub (Feb 20, 2026): RichTextInput's isInside() is just about cursor position when pressing Enter. It has nothing to do with why a response failed or how the error gets displayed. You saw the RangeError in console and the model error toast, and assumed they were the same bug. They're not even in the same layer of the stack. The error parsing in handleOpenAIError tries a few known shapes, FastAPI's detail, OpenAI's error.message, then plain message. And if none match it just stringifies the whole thing. So if the upstream returns an error response in an unexpected format, it'll just dump the raw object. Any backend logs would help here because this is most certainly an upstream error. But first try a newer version.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#35078