[GH-ISSUE #18272] issue: Knowledge Collection RAG not working -> Model Conext Length Overrun #89289

Closed
opened 2026-05-15 14:10:46 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @rahepler2 on GitHub (Oct 13, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/18272

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

Git Clone

Open WebUI Version

0.6.33

Ollama Version (if applicable)

NA

Operating System

Linux

Browser (if applicable)

Chrome - but not important here.

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

When I have a RAG chat and I write into the chat, the model should review the chunks of text on the back end. Then should find the top-k most relevant, and use that to send to the LLM to create a grounded response.

Actual Behavior

I have a knowledge collection attached to the model of around 50 documents. All of them are 1 page, and in markdown format. The top-k is 15, the chunk size in 1500, and the overlap is 225.

For this, when I ask any question of the model I receive:

This model's maximum context length is 128000 tokens. However, your messages resulted in 2892076 tokens. Please reduce the length of the messages.

Changing the top-k will adjust the resulted in xxx tokens.. but won't resolve the issue to a reasonable token amount. There are no tools attached to this model, it's using open ai embeddings, and overall is a basic setup. It should not be struggling with this, and didn't prior to updating.

Steps to Reproduce

  1. Pull docker image.
  2. Upload to Azure Container Apps
  3. Add volume mounts
  4. create a model based on gpt-4o
  5. create a knowledge collection
  6. add collection to model
  7. add correct prompting for rag and model
  8. ask questio
  9. continue receiving the token count to large for every question

Logs & Screenshots

Image

Additional Information

No response

Originally created by @rahepler2 on GitHub (Oct 13, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/18272 ### 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 Git Clone ### Open WebUI Version 0.6.33 ### Ollama Version (if applicable) NA ### Operating System Linux ### Browser (if applicable) Chrome - but not important here. ### 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 When I have a RAG chat and I write into the chat, the model should review the chunks of text on the back end. Then should find the top-k most relevant, and use that to send to the LLM to create a grounded response. ### Actual Behavior I have a knowledge collection attached to the model of around 50 documents. All of them are 1 page, and in markdown format. The top-k is 15, the chunk size in 1500, and the overlap is 225. For this, when I ask any question of the model I receive: This model's maximum context length is 128000 tokens. However, your messages resulted in 2892076 tokens. Please reduce the length of the messages. Changing the top-k will adjust the resulted in xxx tokens.. but won't resolve the issue to a reasonable token amount. There are no tools attached to this model, it's using open ai embeddings, and overall is a basic setup. It should not be struggling with this, and didn't prior to updating. ### Steps to Reproduce 1. Pull docker image. 2. Upload to Azure Container Apps 3. Add volume mounts 4. create a model based on gpt-4o 5. create a knowledge collection 6. add collection to model 7. add correct prompting for rag and model 8. ask questio 9. continue receiving the token count to large for every question ### Logs & Screenshots <img width="949" height="78" alt="Image" src="https://github.com/user-attachments/assets/8392d542-41e7-412d-8b29-cd810cee6468" /> ### Additional Information _No response_
GiteaMirror added the bug label 2026-05-15 14:10:46 -05:00
Author
Owner

@belugaming commented on GitHub (Oct 13, 2025):

same issue

<!-- gh-comment-id:3395739689 --> @belugaming commented on GitHub (Oct 13, 2025): same issue
Author
Owner

@tjbck commented on GitHub (Oct 13, 2025):

Duplicate.

<!-- gh-comment-id:3395768639 --> @tjbck commented on GitHub (Oct 13, 2025): Duplicate.
Author
Owner

@eca-rba commented on GitHub (Nov 4, 2025):

systemprompt has 322 token and prompt has 220 token.

I use Top-K 120, Top-K Reranker 30, Relevance 0,58 und BM25 0,5. Context length of model is 131 072 of gpt-oss-120b with vllm. in openwebui max_token=4096, blocksize 512 and block overlap 100. embedding model bge-m3 and rerank model bge-reranker-v2-m3.

Top-K = 120 → Reranker Top-K = 30, Chunk 512 Tokens ≈ 15 360, metadata,... (~15–30 Tokens/Chunk) ≈ +600–900 citation/IDs/instructions/questions/systemprompt ≈ +800–1 500 = ~16–18k -> so should be enough space in context

but in first prompt with search over rag i get:

max_tokens must be at least 1, got -19333. because the context size is more then 131 072

<!-- gh-comment-id:3486603130 --> @eca-rba commented on GitHub (Nov 4, 2025): systemprompt has 322 token and prompt has 220 token. I use Top-K 120, Top-K Reranker 30, Relevance 0,58 und BM25 0,5. Context length of model is 131 072 of gpt-oss-120b with vllm. in openwebui max_token=4096, blocksize 512 and block overlap 100. embedding model bge-m3 and rerank model bge-reranker-v2-m3. Top-K = 120 → Reranker Top-K = 30, Chunk 512 Tokens ≈ 15 360, metadata,... (~15–30 Tokens/Chunk) ≈ +600–900 citation/IDs/instructions/questions/systemprompt ≈ +800–1 500 = ~16–18k -> so should be enough space in context but in first prompt with search over rag i get: max_tokens must be at least 1, got -19333. because the context size is more then 131 072
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#89289