[GH-ISSUE #8856] PDF Upload - cannot reshape array of size #X into shape #118601

Closed
opened 2026-05-20 19:56:49 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @BloodBlight on GitHub (Jan 24, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8856

Bug Report

Installation Method

Docker

Environment

  • Open WebUI Version: ghcr.io/open-webui/open-webui:main (v0.5.7)
    Note: I had to go to the logs for this, could we add this to the UI somewhere?
  • Operating System: PopOS
  • Browser: Tried both Firefox and Chromium

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • N/A: I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

After uploading a PDF it should be parsed.

Actual Behavior:

It fails with "Failed to add file." and logs report "cannot reshape array of size #X"

Description

Bug Summary:
Seems to be related to image processing for "PDF Extract Images (OCR)". Disabling this allows the document to be uploaded.

Reproduction Details

Steps to Reproduce:
Add this file to a knowledge base:
82c836.pdf

Logs and Screenshots

Browser Console Logs:
N/A

Docker Container Logs:

WARNI [python_multipart.multipart] Skipping data after last boundary
INFO  [open_webui.routers.files] file.content_type: application/pdf
ERROR [open_webui.routers.retrieval] cannot reshape array of size 11609 into shape (2954,3753,newaxis)
Traceback (most recent call last):
  File "/app/backend/open_webui/routers/retrieval.py", line 884, in process_file
    docs = loader.load(
           ^^^^^^^^^^^^
  File "/app/backend/open_webui/retrieval/loaders/main.py", line 127, in load
    docs = loader.load()
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 31, in load
    return list(self.lazy_load())
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/pdf.py", line 257, in lazy_load
    yield from self.parser.parse(blob)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 127, in parse
    return list(self.lazy_parse(blob))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 125, in lazy_parse
    yield from [
               ^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 128, in <listcomp>
    + self._extract_images_from_page(page),
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 147, in _extract_images_from_page
    np.frombuffer(xObject[obj].get_data(), dtype=np.uint8).reshape(
ValueError: cannot reshape array of size 11609 into shape (2954,3753,newaxis)
ERROR [open_webui.routers.files] 400: cannot reshape array of size 11609 into shape (2954,3753,newaxis)
Traceback (most recent call last):
  File "/app/backend/open_webui/routers/retrieval.py", line 884, in process_file
    docs = loader.load(
           ^^^^^^^^^^^^
  File "/app/backend/open_webui/retrieval/loaders/main.py", line 127, in load
    docs = loader.load()
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 31, in load
    return list(self.lazy_load())
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/pdf.py", line 257, in lazy_load
    yield from self.parser.parse(blob)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 127, in parse
    return list(self.lazy_parse(blob))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 125, in lazy_parse
    yield from [
               ^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 128, in <listcomp>
    + self._extract_images_from_page(page),
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 147, in _extract_images_from_page
    np.frombuffer(xObject[obj].get_data(), dtype=np.uint8).reshape(
ValueError: cannot reshape array of size 11609 into shape (2954,3753,newaxis)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/backend/open_webui/routers/files.py", line 74, in upload_file
    process_file(request, ProcessFileForm(file_id=id))
  File "/app/backend/open_webui/routers/retrieval.py", line 962, in process_file
    raise HTTPException(
fastapi.exceptions.HTTPException: 400: cannot reshape array of size 11609 into shape (2954,3753,newaxis)
ERROR [open_webui.routers.files] Error processing file: c8147cb0-87a8-4b21-a8da-93d4c18bad9d

Screenshots/Screen Recordings (if applicable):
N/A

Additional Information

None.

Originally created by @BloodBlight on GitHub (Jan 24, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/8856 # Bug Report ## Installation Method Docker ## Environment - **Open WebUI Version:** ghcr.io/open-webui/open-webui:main (v0.5.7) Note: _I had to go to the logs for this, could we add this to the UI somewhere?_ - **Operating System:** PopOS - **Browser:** Tried both Firefox and Chromium **Confirmation:** - [X] I have read and followed all the instructions provided in the README.md. - [X] I am on the latest version of both Open WebUI and Ollama. - N/A: I have included the browser console logs. - [X] I have included the Docker container logs. - [X] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: After uploading a PDF it should be parsed. ## Actual Behavior: It fails with "Failed to add file." and logs report "cannot reshape array of size #X" ## Description **Bug Summary:** Seems to be related to image processing for "PDF Extract Images (OCR)". Disabling this allows the document to be uploaded. ## Reproduction Details **Steps to Reproduce:** Add this file to a knowledge base: [82c836.pdf](https://github.com/user-attachments/files/18531296/82c836.pdf) ## Logs and Screenshots **Browser Console Logs:** N/A **Docker Container Logs:** ``` WARNI [python_multipart.multipart] Skipping data after last boundary INFO [open_webui.routers.files] file.content_type: application/pdf ERROR [open_webui.routers.retrieval] cannot reshape array of size 11609 into shape (2954,3753,newaxis) Traceback (most recent call last): File "/app/backend/open_webui/routers/retrieval.py", line 884, in process_file docs = loader.load( ^^^^^^^^^^^^ File "/app/backend/open_webui/retrieval/loaders/main.py", line 127, in load docs = loader.load() ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 31, in load return list(self.lazy_load()) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/pdf.py", line 257, in lazy_load yield from self.parser.parse(blob) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 127, in parse return list(self.lazy_parse(blob)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 125, in lazy_parse yield from [ ^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 128, in <listcomp> + self._extract_images_from_page(page), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 147, in _extract_images_from_page np.frombuffer(xObject[obj].get_data(), dtype=np.uint8).reshape( ValueError: cannot reshape array of size 11609 into shape (2954,3753,newaxis) ERROR [open_webui.routers.files] 400: cannot reshape array of size 11609 into shape (2954,3753,newaxis) Traceback (most recent call last): File "/app/backend/open_webui/routers/retrieval.py", line 884, in process_file docs = loader.load( ^^^^^^^^^^^^ File "/app/backend/open_webui/retrieval/loaders/main.py", line 127, in load docs = loader.load() ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 31, in load return list(self.lazy_load()) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/pdf.py", line 257, in lazy_load yield from self.parser.parse(blob) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 127, in parse return list(self.lazy_parse(blob)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 125, in lazy_parse yield from [ ^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 128, in <listcomp> + self._extract_images_from_page(page), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 147, in _extract_images_from_page np.frombuffer(xObject[obj].get_data(), dtype=np.uint8).reshape( ValueError: cannot reshape array of size 11609 into shape (2954,3753,newaxis) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/backend/open_webui/routers/files.py", line 74, in upload_file process_file(request, ProcessFileForm(file_id=id)) File "/app/backend/open_webui/routers/retrieval.py", line 962, in process_file raise HTTPException( fastapi.exceptions.HTTPException: 400: cannot reshape array of size 11609 into shape (2954,3753,newaxis) ERROR [open_webui.routers.files] Error processing file: c8147cb0-87a8-4b21-a8da-93d4c18bad9d ``` **Screenshots/Screen Recordings (if applicable):** N/A ## Additional Information None.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#118601