[GH-ISSUE #19721] issue: API /file upload and adding to collection -> "400: The content provided is empty" #18966

Closed
opened 2026-04-20 01:15:12 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @deliciousbob on GitHub (Dec 3, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/19721

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

0.6.41

Ollama Version (if applicable)

No response

Operating System

Ubuntu 24.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

  1. A file get uploaded and precession with Post API to /files Endpoint
  2. Returns a ID & StatusCode: 200
  3. Add ID to Knolwedge collection via /knowledge/file.id/file/add
  4. File is visible in Knowledge Collection

Actual Behavior

  1. File get uploaded and precession with Post API to /files Endpoint

  2. Returns a ID & StatusCode: 200
    2.1. Entry created in DB: data = "{""status"": ""failed"", ""error"": ""Stream has ended unexpectedly"", ""content"": """"}"
    2.2. OWUI Logs show:
    2025-12-03 16:04:50.800 | INFO | open_webui.routers.files:upload_file_handler:182 - file.content_type: application/pdf 2025-12-03 16:04:50.804 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - IP-Address - "POST /api/v1/files/?process=true&internal=false HTTP/1.1" 200 2025-12-03 16:04:50.805 | WARNING | pypdf._utils:logger_warning:457 - invalid pdf header: b'\n\n\n\n\n' 2025-12-03 16:04:50.811 | WARNING | pypdf._utils:logger_warning:457 - EOF marker not found 2025-12-03 16:04:50.812 | ERROR | open_webui.routers.retrieval:process_file:1651 - Stream has ended unexpectedly File "/usr/local/lib/python3.11/site-packages/pypdf/_utils.py", line 316, in read_previous_line raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) │ └ 'Stream has ended unexpectedly' └ <class 'pypdf.errors.PdfStreamError'> pypdf.errors.PdfStreamError: Stream has ended unexpectedly 2025-12-03 16:04:50.815 | ERROR | open_webui.routers.files:process_uploaded_file:142 - Error processing file: 70a7ee8b-2a38-4d5f-9f19-cdcfeefeb266

  3. Add ID to Knolwedge collection via /knowledge/file.id/file/add
    4.1. Response 400: 400: The content provided is empty. Please ensure that there is text or data present before proceeding.

I saw that

Steps to Reproduce

See: Actual Behavior

Logs & Screenshots

See description, but i can provide further logs if neeeded

Additional Information

It was working all fine in Version 0.6.25 (as far as i can remember), something must have changed since then.

Originally created by @deliciousbob on GitHub (Dec 3, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/19721 ### 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 0.6.41 ### Ollama Version (if applicable) _No response_ ### Operating System Ubuntu 24.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 1. A file get uploaded and precession with Post API to /files Endpoint 2. Returns a ID & StatusCode: 200 3. Add ID to Knolwedge collection via /knowledge/file.id/file/add 4. File is visible in Knowledge Collection ### Actual Behavior 1. File get uploaded and precession with Post API to /files Endpoint 2. Returns a ID & StatusCode: 200 2.1. Entry created in DB: data = "{""status"": ""failed"", ""error"": ""Stream has ended unexpectedly"", ""content"": """"}" 2.2. OWUI Logs show: `2025-12-03 16:04:50.800 | INFO | open_webui.routers.files:upload_file_handler:182 - file.content_type: application/pdf 2025-12-03 16:04:50.804 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - IP-Address - "POST /api/v1/files/?process=true&internal=false HTTP/1.1" 200 2025-12-03 16:04:50.805 | WARNING | pypdf._utils:logger_warning:457 - invalid pdf header: b'\n\n\n\n\n' 2025-12-03 16:04:50.811 | WARNING | pypdf._utils:logger_warning:457 - EOF marker not found 2025-12-03 16:04:50.812 | ERROR | open_webui.routers.retrieval:process_file:1651 - Stream has ended unexpectedly File "/usr/local/lib/python3.11/site-packages/pypdf/_utils.py", line 316, in read_previous_line raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) │ └ 'Stream has ended unexpectedly' └ <class 'pypdf.errors.PdfStreamError'> pypdf.errors.PdfStreamError: Stream has ended unexpectedly 2025-12-03 16:04:50.815 | ERROR | open_webui.routers.files:process_uploaded_file:142 - Error processing file: 70a7ee8b-2a38-4d5f-9f19-cdcfeefeb266 ` 4. Add ID to Knolwedge collection via /knowledge/file.id/file/add 4.1. Response 400: 400: The content provided is empty. Please ensure that there is text or data present before proceeding. I saw that ### Steps to Reproduce See: Actual Behavior ### Logs & Screenshots See description, but i can provide further logs if neeeded ### Additional Information It was working all fine in Version 0.6.25 (as far as i can remember), something must have changed since then.
GiteaMirror added the bug label 2026-04-20 01:15:12 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Dec 3, 2025):

🔍 Similar Issues Found

I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:

  1. #19701 issue: knowledge can not multiple upload file
    by willy808 • Dec 03, 2025 • bug

  2. #19519 issue: Base64 encoded images included in API responses
    by luke-wren • Nov 26, 2025 • bug

  3. #14664 issue: Upload to knowledge base sometimes fails with error 400 The content provided is empty
    by YetheSamartaka • Jun 04, 2025 • bug

  4. #19558 issue: When using the “Upload a document” feature in the chat, it returns the following message: “Please provide the content of the attachment. I will prepare a summary based on the information in the file.”
    by jiunmoon • Nov 28, 2025 • bug

  5. #17446 issue: file upload bug from 0.6.23
    by K7cl • Sep 14, 2025 • bug

Show 5 more related issues
  1. #14432 issue: After update /api/v1/retrieval/query/collection return 400
    by SebaGue • May 28, 2025 • bug

  2. #18142 issue: File upload not working ("list index out of range")
    by Elwag • Oct 08, 2025 • bug

  3. #15190 issue: The content provided is empty. Please ensure that there is text or data present before proceeding.
    by Farmouss • Jun 21, 2025 • bug

  4. #19496 issue: 500 internal server error appears in v0.6.40
    by cloudtuotuo • Nov 26, 2025 • bug

  5. #13574 issue: /api/v1/files/ upload endpoint succeeds, but file is not processed (data.content remains empty)
    by LosaLosSantos • May 06, 2025 • bug


💡 Tips:

  • If this is a duplicate, please consider closing this issue and adding any additional details to the existing one
  • If you found a solution in any of these issues, please share it here to help others

This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.

<!-- gh-comment-id:3607717065 --> @owui-terminator[bot] commented on GitHub (Dec 3, 2025): 🔍 **Similar Issues Found** I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions: 1. [#19701](https://github.com/open-webui/open-webui/issues/19701) **issue: knowledge can not multiple upload file** *by willy808 • Dec 03, 2025 • `bug`* 2. [#19519](https://github.com/open-webui/open-webui/issues/19519) **issue: Base64 encoded images included in API responses** *by luke-wren • Nov 26, 2025 • `bug`* 3. [#14664](https://github.com/open-webui/open-webui/issues/14664) **issue: Upload to knowledge base sometimes fails with error 400 The content provided is empty** *by YetheSamartaka • Jun 04, 2025 • `bug`* 4. [#19558](https://github.com/open-webui/open-webui/issues/19558) **issue: When using the “Upload a document” feature in the chat, it returns the following message: “Please provide the content of the attachment. I will prepare a summary based on the information in the file.”** *by jiunmoon • Nov 28, 2025 • `bug`* 5. [#17446](https://github.com/open-webui/open-webui/issues/17446) **issue: file upload bug from 0.6.23** *by K7cl • Sep 14, 2025 • `bug`* <details> <summary>Show 5 more related issues</summary> 6. [#14432](https://github.com/open-webui/open-webui/issues/14432) **issue: After update /api/v1/retrieval/query/collection return 400** *by SebaGue • May 28, 2025 • `bug`* 7. [#18142](https://github.com/open-webui/open-webui/issues/18142) **issue: File upload not working ("list index out of range")** *by Elwag • Oct 08, 2025 • `bug`* 8. [#15190](https://github.com/open-webui/open-webui/issues/15190) **issue: The content provided is empty. Please ensure that there is text or data present before proceeding.** *by Farmouss • Jun 21, 2025 • `bug`* 9. [#19496](https://github.com/open-webui/open-webui/issues/19496) **issue: 500 internal server error appears in v0.6.40** *by cloudtuotuo • Nov 26, 2025 • `bug`* 10. [#13574](https://github.com/open-webui/open-webui/issues/13574) **issue: /api/v1/files/ upload endpoint succeeds, but file is not processed (data.content remains empty)** *by LosaLosSantos • May 06, 2025 • `bug`* </details> --- 💡 **Tips:** - If this is a duplicate, please consider closing this issue and adding any additional details to the existing one - If you found a solution in any of these issues, please share it here to help others *This comment was generated automatically by a bot.* Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
Author
Owner

@rgaricano commented on GitHub (Dec 3, 2025):

Possible Causes:

  • Corrupted Upload: The PDF file was corrupted during upload.
  • Invalid PDF: The source file is not a valid PDF document.
  • Empty File: The file may contain only null bytes (as suggested by the header warning).
  • Network Issues: Intermittent network problems during file transfer.

Solutions:

  • Re-upload the file: Try uploading the PDF again.
  • Verify PDF integrity: Check if the original PDF opens correctly in a PDF viewer.
  • Use alternative extraction: Configure a different content extraction engine like Tika, Docling or external one.
  • Check file size limits: Ensure the file isn't truncated due to size limits.
<!-- gh-comment-id:3607783553 --> @rgaricano commented on GitHub (Dec 3, 2025): Possible Causes: - Corrupted Upload: The PDF file was corrupted during upload. - Invalid PDF: The source file is not a valid PDF document. - Empty File: The file may contain only null bytes (as suggested by the header warning). - Network Issues: Intermittent network problems during file transfer. Solutions: - Re-upload the file: Try uploading the PDF again. - Verify PDF integrity: Check if the original PDF opens correctly in a PDF viewer. - Use alternative extraction: Configure a different content extraction engine like Tika, Docling or external one. - Check file size limits: Ensure the file isn't truncated due to size limits.
Author
Owner

@Classic298 commented on GitHub (Dec 3, 2025):

Or the configured content extraction engine could not extract any content from the PDF

<!-- gh-comment-id:3608058779 --> @Classic298 commented on GitHub (Dec 3, 2025): Or the configured content extraction engine could not extract any content from the PDF
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#18966