issue: Upload to knowledge base sometimes fails with error 400 The content provided is empty #5440

Closed
opened 2025-11-11 16:21:05 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @YetheSamartaka on GitHub (Jun 4, 2025).

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

0.6.13

Ollama Version (if applicable)

0.6.8

Operating System

Ubuntu 22.04

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

File is uploaded without issues

Actual Behavior

File is sometimes uploaded with errors

Steps to Reproduce

When I use the official cookbok and the code to upload a file:
https://github.com/open-webui/cookbook/blob/main/knowledge/add-to-knowledge.ipynb

def upload_file(file_path):
url = f'{WEBUI_URL}/api/v1/files/'
headers = {
'Authorization': f'Bearer {TOKEN}',
'Accept': 'application/json'
}
files = {'file': open(file_path, 'rb')}
response = requests.post(url, headers=headers, files=files)
return response.json()

It can return the file_id before the file is actually processed. So when I use another method to add it to the knowledge, it fails:

def add_file_to_knowledge(knowledge_id, file_id):
url = f'{WEBUI_URL}/api/v1/knowledge/{knowledge_id}/file/add'
headers = {
'Authorization': f'Bearer {TOKEN}',
'Content-Type': 'application/json'
}
data = {'file_id': file_id}
response = requests.post(url, headers=headers, json=data)
return response.json()

I get the following error:
Error 400: The content provided is empty. Please ensure that there is text or data present before proceeding

Logs & Screenshots

I am using bge-m3 embedding model and apache tika

Additional Information

No response

Originally created by @YetheSamartaka on GitHub (Jun 4, 2025). ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version 0.6.13 ### Ollama Version (if applicable) 0.6.8 ### Operating System Ubuntu 22.04 ### 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 File is uploaded without issues ### Actual Behavior File is sometimes uploaded with errors ### Steps to Reproduce When I use the official cookbok and the code to upload a file: https://github.com/open-webui/cookbook/blob/main/knowledge/add-to-knowledge.ipynb def upload_file(file_path): url = f'{WEBUI_URL}/api/v1/files/' headers = { 'Authorization': f'Bearer {TOKEN}', 'Accept': 'application/json' } files = {'file': open(file_path, 'rb')} response = requests.post(url, headers=headers, files=files) return response.json() It can return the file_id before the file is actually processed. So when I use another method to add it to the knowledge, it fails: def add_file_to_knowledge(knowledge_id, file_id): url = f'{WEBUI_URL}/api/v1/knowledge/{knowledge_id}/file/add' headers = { 'Authorization': f'Bearer {TOKEN}', 'Content-Type': 'application/json' } data = {'file_id': file_id} response = requests.post(url, headers=headers, json=data) return response.json() I get the following error: Error 400: The content provided is empty. Please ensure that there is text or data present before proceeding ### Logs & Screenshots I am using bge-m3 embedding model and apache tika ### Additional Information _No response_
GiteaMirror added the bug label 2025-11-11 16:21:05 -06:00
Author
Owner

@YetheSamartaka commented on GitHub (Jun 5, 2025):

I have found out that people are having similar issues:
https://github.com/open-webui/open-webui/discussions/13600

@YetheSamartaka commented on GitHub (Jun 5, 2025): I have found out that people are having similar issues: https://github.com/open-webui/open-webui/discussions/13600
Author
Owner

@lrnmid commented on GitHub (Jun 6, 2025):

我发现人们也有类似的问题:#13600

我也有这种问题,但是我解决了,请查看你的ocr设置,看看你是用的哪种。建议用默认的,我怀疑是因为文件过大或者,ocr处理能力的问题

@lrnmid commented on GitHub (Jun 6, 2025): > 我发现人们也有类似的问题:[#13600](https://github.com/open-webui/open-webui/discussions/13600) 我也有这种问题,但是我解决了,请查看你的ocr设置,看看你是用的哪种。建议用默认的,我怀疑是因为文件过大或者,ocr处理能力的问题
Author
Owner

@YetheSamartaka commented on GitHub (Jun 7, 2025):

I have OCR turned off. I only upload .md files.

@YetheSamartaka commented on GitHub (Jun 7, 2025): I have OCR turned off. I only upload .md files.
Author
Owner

@tjbck commented on GitHub (Jun 16, 2025):

Could you share the file you uploaded? @jackthgu

@tjbck commented on GitHub (Jun 16, 2025): Could you share the file you uploaded? @jackthgu
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#5440