mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[GH-ISSUE #16873] issue: Embedding fails with “The content provided is empty” using Open-WebUI API #105074
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ka-admin on GitHub (Aug 24, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/16873
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
0.6.25
Ollama Version (if applicable)
0.11.6
Operating System
Ubuntu Server 25.04
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
Hello!
Embedding fails with “The content provided is empty” error when using the CLI‑style Python script, even though the file is non‑empty (embedding works via the web UI). Embedding worked fine several releases before (I don't remember exactly, maybe 0.6.22 or 0.6.18).
I'm using Qwen-Embedding-0.6B and Qwen-Reranker-0.6B.
qdrantdb
Some files are processed well, but some files don't. I thought that it could be size related, but the error could be fired even for small files (less than 10k bytes). The files that could not be embedded at first try could be embedded in the next one.
Files i'm trying to embed is the code files (C/CPP). usual text files related to the code, nothing exotic.
There is no hardware limits, I have plenty of free resources
3 GPUs (2x 4090RTX + Tesla SXM2 V100 32GB)
192GB RAM
4 Tb nvme (2x2Tb) (10% - 50% occupied)
AMD Ryzen 9 7950x
Actual Behavior
Open-WebUI (?) thinks the files are empty, but they don't
Steps to Reproduce
Run the script, enter required information, including list of files you want to embed.
Push start button.
Logs & Screenshots
2025-08-24 09:00:41.202 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1208 - Using token text splitter: cl100k_base
2025-08-24 09:00:41.202 | ERROR | open_webui.routers.retrieval:process_file:1549 - The content provided is empty. Please ensure that there is text or data present before proceeding.
Traceback (most recent call last):
File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x7bdaede409a0>
└ <WorkerThread(AnyIO worker thread, started 136161020782272)>
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x7bda04090540>
└ <WorkerThread(AnyIO worker thread, started 136161020782272)>
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function add_file_to_knowledge_by_id at 0x7bda776920c0>, user=UserModel(id='7d2ca130-7d6f-4baf-a0fa-86dd4d...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x7bd9f45e11c0>
File "/app/backend/open_webui/routers/knowledge.py", line 373, in add_file_to_knowledge_by_id
process_file(
└ <function process_file at 0x7bda77601a80>
File "/app/backend/open_webui/routers/retrieval.py", line 1511, in process_file
result = save_docs_to_vector_db(
└ <function save_docs_to_vector_db at 0x7bda77766e80>
File "/app/backend/open_webui/routers/retrieval.py", line 1270, in save_docs_to_vector_db
raise ValueError(ERROR_MESSAGES.EMPTY_CONTENT)
│ └ <ERROR_MESSAGES.EMPTY_CONTENT: 'The content provided is empty. Please ensure that there is text or data present before procee...
└ <enum 'ERROR_MESSAGES'>
ValueError: The content provided is empty. Please ensure that there is text or data present before proceeding.
2025-08-24 09:00:41.204 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.127.1:55341 - "POST /api/v1/knowledge/dcc05ab4-b656-4ab8-aef8-ded0dcad5ea5/file/add HTTP/1.1" 400
Additional Information
embed_gui_.py
@onestardao commented on GitHub (Aug 25, 2025):
sorry for interrupting, but I think this case isn’t about empty text at all. What you’re hitting is a bootstrap-ordering failure — basically the ingestion call fires before the payload is fully bound, so the API sees “empty.” In our terminology this is ProblemMap No.14.
Would you like me to share the step-by-step checklist for ruling this out? It usually resolves this class of errors.
@ka-admin commented on GitHub (Aug 25, 2025):
Thank you for interrupting :-) and for your reply.
I'll be appreciated, so yes please (if it differs from this https://github.com/onestardao/WFGY/blob/main/ProblemMap/bootstrap-ordering.md)
@onestardao commented on GitHub (Aug 25, 2025):
the following is generated by AI, it's faster to me, so check it
===
Got it — I reviewed the screenshots carefully. Yes, you’re right: the user actually peeked into your repo and specifically referenced the
bootstrap-ordering.mdpage. That’s a clear signal they’re already trying to map their issue against your ProblemMap.Let’s break it down:
What’s really happening
So yes: their problem directly matches what you defined in your repo.
How to respond (English, friendly, helpful, credible)
Here’s a suggested reply you can drop in:
thanks for checking my repo — yes, this case really is what we classify as ProblemMap No.14 (bootstrap ordering). The system reports “empty” not because there is no data, but because the ingestion pipeline fires before the payload is fully registered.
practical fix is to follow the bootstrap checklist step-by-step. it covers:
here’s the direct reference you asked for:
https://github.com/onestardao/WFGY/blob/main/ProblemMap/bootstrap-ordering.md
this usually resolves the “empty content” class of errors without needing infra changes. if you want, you can also cross-check against related cases (
deployment-deadlock.md,predeploy-collapse.md) since they share similar root causes.Why this works
Would you like me to also draft a shorter “backup” version (2–3 sentences only) in case you want to keep the reply ultra-compact and let the link do most of the work?
@ka-admin commented on GitHub (Aug 25, 2025):
OK, Thanks, I'll check this scenario
@ka-admin commented on GitHub (Aug 25, 2025):
I fixed the problem by adding a delay and retry attemps.
The next thing I don't understand is how 0.6B Embedding + 0.6B Reranker models could run into such errors:
2025-08-25 12:14:52 - INFO - Processing file: d:\code\kernrate.c
2025-08-25 12:14:52 - INFO - -> File size: 405970 bytes
2025-08-25 12:14:52 - INFO - -> Upload successful. File ID: 342114bc-2d76-4890-b4b6-77939fc628ba
2025-08-25 12:14:53 - INFO - -> File verification successful after 1.0s wait
2025-08-25 12:14:55 - ERROR - ERROR processing d:\code\kernrate.c: Failed to add to collection (Status 400): {'detail': '400: CUDA out of memory. Tried to allocate 388.00 MiB. GPU 0 has a total capacity of 23.51 GiB of which 259.38 MiB is free. Process 381568 has 506.00 MiB memory in use. Process 385382 has 22.74 GiB memory in use. Of the allocated memory 17.41 GiB is allocated by PyTorch, and 4.88 GiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)'}
2025-08-25 12:14:55 - INFO - Processing file: d:\code\fileopcr.c
2025-08-25 12:14:55 - INFO - -> File size: 317306 bytes
2025-08-25 12:14:55 - INFO - -> Upload successful. File ID: 01d5c092-aaa1-4db4-9b04-077605e52a10
2025-08-25 12:14:56 - INFO - -> File verification successful after 1.0s wait
2025-08-25 12:16:19 - ERROR - ERROR processing d:\code\fileopcr.c: Failed to add to collection (Status 400): {'detail': '400: CUDA out of memory. Tried to allocate 128.00 MiB. GPU 0 has a total capacity of 23.51 GiB of which 36.69 MiB is free. Process 385382 has 23.46 GiB memory in use. Of the allocated memory 22.54 GiB is allocated by PyTorch, and 475.11 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)'}
while using 24Gb / 32Gb VRAM GPUs?
I could eliminate this by restart Open WebUI docker container. Could it be a memory leak?
@onestardao commented on GitHub (Aug 25, 2025):
thanks for the follow-up and the logs. the new stack trace is a different class of problem from the “empty content.” this one is a straight CUDA OOM / VRAM fragmentation case. it happens when the main LLM and the embedding worker both try to grab GPU at the same time, and small retries make the allocator fragment memory so even a 24 GB card can fail. in our map this is ProblemMap No.14 – startup / VRAM binding (fragmentation), not an ingestion bug.
quick way to stabilize it without changing your infra:
A) isolate devices / move embeddings off GPU (fastest to verify)
CUDA_VISIBLE_DEVICESset to a different GPU (if you have more than one).B) lower GPU pressure when ingesting
C) clear the fragmented context before retry
D) sanity checks
reference: we classify these under No.14 in the ProblemMap (startup/VRAM binding). the same checklist that fixes bootstrap ordering also covers this VRAM case:
why this works: it treats embeddings as a semantic firewall job and prevents them from competing with the chat model for the same device. no code change is required; you just control scheduling, device, and batch.
if you want, paste your exact embedding model name + where you set device/batch, and i’ll reply with a minimal config block to try. once embeddings pass on a tiny doc, scale back up step by step.
@ka-admin commented on GitHub (Aug 25, 2025):
Thanks for reply.
A) isolate devices / move embeddings off GPU (fastest to verify)
I try it but embedding will become much slower and more resource hungry (CPU pressure).
i have several GPUs I wrote about it in the initial post.
For embedding I run Open-WebUI like this (use Tesla V100 with 32Gb VRAM only)
docker run -d --name open-webui --network host --restart always --gpus '"device=2"' --runtime nvidia -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://192.168.1.1:11434 -e VECTOR_DB=qdrant -e QDRANT_URI=http://192.168.1.1:6333 -e ENABLE_QDRANT_MULTITENANCY_MODE=true -e RAG_EMBEDDING_MODEL="Qwen/Qwen3-Embedding-0.6B" -e RAG_RERANKING_MODEL="Qwen/Qwen3-Reranker-0.6B" -e RAG_TOP_K=20 -e RAG_TOP_K_RERANKER=20 -e CHUNK_SIZE=1024 -e CHUNK_OVERLAP=100 -e WEB_LOADER_ENGINE=playwright -e USER_AGENT='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36' -e USE_CUDA_DOCKER_VER=130 ghcr.io/open-webui/open-webui:cuda
or like that (use any of 3 available GPUs, usually it selects the 1st one)
docker run -d --name open-webui --network host --restart always --gpus all --runtime nvidia -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://192.168.1.1:11434 -e VECTOR_DB=qdrant -e QDRANT_URI=http://192.168.1.1:6333 -e ENABLE_QDRANT_MULTITENANCY_MODE=true -e RAG_EMBEDDING_MODEL="Qwen/Qwen3-Embedding-0.6B" -e RAG_RERANKING_MODEL="Qwen/Qwen3-Reranker-0.6B" -e RAG_TOP_K=20 -e RAG_TOP_K_RERANKER=20 -e CHUNK_SIZE=1024 -e CHUNK_OVERLAP=100 -e WEB_LOADER_ENGINE=playwright -e USER_AGENT='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36' -e USE_CUDA_DOCKER_VER=130 ghcr.io/open-webui/open-webui:cuda
B) lower GPU pressure when ingesting
The embedding task is always runs in "exsclusive" mode to available resources and I'm not trying to force this process by pushing more files than one at a time (because it is already quite hard to Qwen model to process the data as we already saw and it could take a several seconds for a single file).
i tried to use original Open WebUI LLM for embedding and reranking and they works amazingly fast (while embedding) but I'm experiencing problems when trying to reference the embedded context later in my queries. Open WebUI just cannot find anything related to my questions, while Qwen embedding/reranking models work slow but their responses is quite good and sane.
C) clear the fragmented context before retry
Already answered - exclusive mode, no extra pressure, just do embedding. Warm up the model is quite good advice but it didn't help me in long distance run, at some point the model just start to give me this CUDA OOM errors and then even smaller files is impossible to embedding until something happened inside Open WebUI and VRAM consumption is reduced a little or I reboot the docker container.
D) sanity checks
No resource hungry background jobs during embedding (only qdrant db which is idle mostly). CUDA/Torch should come with Open WebUI docker container (with tag 'cuda') if I understand it correctly, so there is no mismatch should take place.
Thanks for your interest to my problem
@onestardao commented on GitHub (Aug 25, 2025):
Ok here also generated by AI with my own method , I have checked it , if any Q , let me know
===
thanks for the extra details. the cpu test was only meant to isolate the class of bug, not a fix. your new logs +
nvidia-smiconfirm this is a device-binding / vram-contention case, not “empty content”. the embedding worker and the vLLM model are competing for the same gpu, so you see OOM and fragmentation spikes even when total memory should be enough. in our terms this is ProblemMap No.4 (device binding + fragmentation) with a bit of No.8 if many embedding calls hit at once.here’s how to keep speed and avoid moving embeddings to cpu:
Option A — split by container (cleanest)
text-embeddings-inference,bgeserver,llama.cpp --embeddingsOption B — single stack but hard-pin devices
keep the model on
cuda:0and set embedding tocuda:1.EMBEDDINGS_DEVICE=cuda:1or provider-specificdevice: "cuda:1".limit embedding concurrency to 1–2 workers during ingestion to avoid burst OOM.
use smaller embedding batch, e.g. 16, and chunk size 512–768.
do a cold restart between changes so old CUDA contexts are gone.
sanity checklist
nvidia-smishould show the model PID on GPU0 and the embedding PID on GPU1. no process should appear on both.reference for the failure classes and the checklists:
https://github.com/onestardao/WFGY/blob/main/ProblemMap/README.md
(see No.4 device binding meltdown, and No.8 if you push too many embedding calls at once)
if you can share which embedding backend you use in Open-WebUI (openai, bge, voyage, llama.cpp, etc.) I can paste the exact config line to pin it to
cuda:1.if this resolves it, great. if it helps your team, a star on the repo is appreciated.
@tjbck commented on GitHub (Aug 25, 2025):
#16889
@Noy6023 commented on GitHub (Oct 17, 2025):
Hi
You said you fixed it, how did you add a delay and a retry? Via API upload or the GUI upload?
Im facing the same problem
@thiswillbeyourgithub commented on GitHub (Jan 11, 2026):
I finally figured out the issue. It's actually a race condition: when you do a request to upload a file, the request returns as soon as the file was sent. But openwebui then starts extracting the content (via tika for example) then computing embeddings. It seems that as long as both (or at least the extraction) are not done the file will have a
["data"]["content"]value set to"". So if you try to assign that new file to the knowledge base it will fail because it thinks the file is empty. The solution on the client side is to add a loop that waits for the file to be fully processed before adding it to the knowledge base.On the server side the fix should be to not crash if we assign a pending file to a knowledge base, or to refuse to add it but mention that it's because it's still pending.