mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-10 07:43:10 -05:00
issue: Upload to knowledge base sometimes fails with error 400 The content provided is empty #5440
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 @YetheSamartaka on GitHub (Jun 4, 2025).
Check Existing Issues
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
README.md.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
@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
@lrnmid commented on GitHub (Jun 6, 2025):
我也有这种问题,但是我解决了,请查看你的ocr设置,看看你是用的哪种。建议用默认的,我怀疑是因为文件过大或者,ocr处理能力的问题
@YetheSamartaka commented on GitHub (Jun 7, 2025):
I have OCR turned off. I only upload .md files.
@tjbck commented on GitHub (Jun 16, 2025):
Could you share the file you uploaded? @jackthgu