[GH-ISSUE #6924] PDF parsing failed #134262

Closed
opened 2026-05-25 00:05:40 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @hongbo-miao on GitHub (Nov 13, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/6924

Bug Report


Installation Method

My Open WebUI deployed in Kubernetes.

I am uploading some ISO 15118 PDF files to a knowledge collection.

These PDFs all succeed.

  • ISO 15118-3.pdf
  • ISO 15118-4.pdf
  • ISO 15118-5.pdf

However, ISO 15118-2.pdf failed.

Environment

  • Open WebUI Version: v0.3.35

  • Operating System:: Ubuntu 22

  • Browser (if applicable): Brave Version 1.71.123 Chromium: 130.0.6723.116 (Official Build) (arm64)

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.
  • 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:

[Describe what you expected to happen.]

Actual Behavior:

[Describe what actually happened.]

Description

Bug Summary:
[Provide a brief but clear summary of the bug]

Reproduction Details

Steps to Reproduce:

  1. Create a knowledge collection
  2. Upload the PDF (I can send the PDF through a private chat for example https://x.com/hongbo_miao or email)

Logs and Screenshots

Browser Console Logs:

Extracted content is not available for this file. Please ensure that the file is processed before proceeding.

image

Docker Container Logs:

INFO  [open_webui.apps.webui.routers.files] file.content_type: application/pdf
ERROR [open_webui.apps.retrieval.main] Invalid Elementary Object starting with b'\xc1' @0: b'\xc1\xd0\nq\n5 0 0 5 12 26 cm\n/WaZ1Ovl69HCArOV3 Do\nQ\nq\n5 0 0 5 12 20 cm\n/W1ZDOklB9oCDrMV'
Traceback (most recent call last):
  File "/app/backend/open_webui/apps/retrieval/main.py", line 841, in process_file
    docs = loader.load(
           ^^^^^^^^^^^^
  File "/app/backend/open_webui/apps/retrieval/loaders/main.py", line 125, in load
    docs = loader.load()
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 30, in load
    return list(self.lazy_load())
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/pdf.py", line 202, in lazy_load
    yield from self.parser.parse(blob)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 126, in parse
    return list(self.lazy_parse(blob))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 124, in lazy_parse
    yield from [
               ^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 126, in <listcomp>
    page_content=_extract_text_from_page(page=page)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 117, in _extract_text_from_page
    return page.extract_text(
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pypdf/_page.py", line 2102, in extract_text
    return self._extract_text(
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pypdf/_page.py", line 1823, in _extract_text
    for operands, operator in content.operations:
                              ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1265, in operations
    self._parse_content_stream(BytesIO(b_(self._data)))
  File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1171, in _parse_content_stream
    operands.append(read_object(stream, None, self.forced_encoding))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1340, in read_object
    raise PdfReadError(
pypdf.errors.PdfReadError: Invalid Elementary Object starting with b'\xc1' @0: b'\xc1\xd0\nq\n5 0 0 5 12 26 cm\n/WaZ1Ovl69HCArOV3 Do\nQ\nq\n5 0 0 5 12 20 cm\n/W1ZDOklB9oCDrMV'
ERROR [open_webui.apps.webui.routers.files] 400: Invalid Elementary Object starting with b'\xc1' @0: b'\xc1\xd0\nq\n5 0 0 5 12 26 cm\n/WaZ1Ovl69HCArOV3 Do\nQ\nq\n5 0 0 5 12 20 cm\n/W1ZDOklB9oCDrMV'
Traceback (most recent call last):
  File "/app/backend/open_webui/apps/retrieval/main.py", line 841, in process_file
    docs = loader.load(
           ^^^^^^^^^^^^
  File "/app/backend/open_webui/apps/retrieval/loaders/main.py", line 125, in load
    docs = loader.load()
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 30, in load
    return list(self.lazy_load())
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/pdf.py", line 202, in lazy_load
    yield from self.parser.parse(blob)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 126, in parse
    return list(self.lazy_parse(blob))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 124, in lazy_parse
    yield from [
               ^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 126, in <listcomp>
    page_content=_extract_text_from_page(page=page)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 117, in _extract_text_from_page
    return page.extract_text(
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pypdf/_page.py", line 2102, in extract_text
    return self._extract_text(
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pypdf/_page.py", line 1823, in _extract_text
    for operands, operator in content.operations:
                              ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1265, in operations
    self._parse_content_stream(BytesIO(b_(self._data)))
  File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1171, in _parse_content_stream
    operands.append(read_object(stream, None, self.forced_encoding))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1340, in read_object
    raise PdfReadError(
pypdf.errors.PdfReadError: Invalid Elementary Object starting with b'\xc1' @0: b'\xc1\xd0\nq\n5 0 0 5 12 26 cm\n/WaZ1Ovl69HCArOV3 Do\nQ\nq\n5 0 0 5 12 20 cm\n/W1ZDOklB9oCDrMV'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/backend/open_webui/apps/webui/routers/files.py", line 71, in upload_file
    process_file(ProcessFileForm(file_id=id))
  File "/app/backend/open_webui/apps/retrieval/main.py", line 903, in process_file
    raise HTTPException(
fastapi.exceptions.HTTPException: 400: Invalid Elementary Object starting with b'\xc1' @0: b'\xc1\xd0\nq\n5 0 0 5 12 26 cm\n/WaZ1Ovl69HCArOV3 Do\nQ\nq\n5 0 0 5 12 20 cm\n/W1ZDOklB9oCDrMV'
ERROR [open_webui.apps.webui.routers.files] Error processing file: c07370c2-5dfe-4cc1-8a38-0060fca2513b

Additional Information

I guess this https://github.com/open-webui/open-webui/issues/6844 may help resolve the issue.

Originally created by @hongbo-miao on GitHub (Nov 13, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/6924 # Bug Report --- ## Installation Method My Open WebUI deployed in Kubernetes. I am uploading some ISO 15118 PDF files to a knowledge collection. These PDFs all succeed. - ISO 15118-3.pdf - ISO 15118-4.pdf - ISO 15118-5.pdf However, `ISO 15118-2.pdf` failed. ## Environment - **Open WebUI Version:** v0.3.35 - **Operating System:**: Ubuntu 22 - **Browser (if applicable):** Brave Version 1.71.123 Chromium: 130.0.6723.116 (Official Build) (arm64) **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. - [x] 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: [Describe what you expected to happen.] ## Actual Behavior: [Describe what actually happened.] ## Description **Bug Summary:** [Provide a brief but clear summary of the bug] ## Reproduction Details **Steps to Reproduce:** 1. Create a knowledge collection 2. Upload the PDF (I can send the PDF through a private chat for example https://x.com/hongbo_miao or email) ## Logs and Screenshots **Browser Console Logs:** > Extracted content is not available for this file. Please ensure that the file is processed before proceeding. ![image](https://github.com/user-attachments/assets/bceb91e5-e94f-4917-84b3-d31893f1d476) **Docker Container Logs:** ```sh INFO [open_webui.apps.webui.routers.files] file.content_type: application/pdf ERROR [open_webui.apps.retrieval.main] Invalid Elementary Object starting with b'\xc1' @0: b'\xc1\xd0\nq\n5 0 0 5 12 26 cm\n/WaZ1Ovl69HCArOV3 Do\nQ\nq\n5 0 0 5 12 20 cm\n/W1ZDOklB9oCDrMV' Traceback (most recent call last): File "/app/backend/open_webui/apps/retrieval/main.py", line 841, in process_file docs = loader.load( ^^^^^^^^^^^^ File "/app/backend/open_webui/apps/retrieval/loaders/main.py", line 125, in load docs = loader.load() ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 30, in load return list(self.lazy_load()) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/pdf.py", line 202, in lazy_load yield from self.parser.parse(blob) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 126, in parse return list(self.lazy_parse(blob)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 124, in lazy_parse yield from [ ^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 126, in <listcomp> page_content=_extract_text_from_page(page=page) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 117, in _extract_text_from_page return page.extract_text( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pypdf/_page.py", line 2102, in extract_text return self._extract_text( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pypdf/_page.py", line 1823, in _extract_text for operands, operator in content.operations: ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1265, in operations self._parse_content_stream(BytesIO(b_(self._data))) File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1171, in _parse_content_stream operands.append(read_object(stream, None, self.forced_encoding)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1340, in read_object raise PdfReadError( pypdf.errors.PdfReadError: Invalid Elementary Object starting with b'\xc1' @0: b'\xc1\xd0\nq\n5 0 0 5 12 26 cm\n/WaZ1Ovl69HCArOV3 Do\nQ\nq\n5 0 0 5 12 20 cm\n/W1ZDOklB9oCDrMV' ERROR [open_webui.apps.webui.routers.files] 400: Invalid Elementary Object starting with b'\xc1' @0: b'\xc1\xd0\nq\n5 0 0 5 12 26 cm\n/WaZ1Ovl69HCArOV3 Do\nQ\nq\n5 0 0 5 12 20 cm\n/W1ZDOklB9oCDrMV' Traceback (most recent call last): File "/app/backend/open_webui/apps/retrieval/main.py", line 841, in process_file docs = loader.load( ^^^^^^^^^^^^ File "/app/backend/open_webui/apps/retrieval/loaders/main.py", line 125, in load docs = loader.load() ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 30, in load return list(self.lazy_load()) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/pdf.py", line 202, in lazy_load yield from self.parser.parse(blob) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 126, in parse return list(self.lazy_parse(blob)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 124, in lazy_parse yield from [ ^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 126, in <listcomp> page_content=_extract_text_from_page(page=page) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/parsers/pdf.py", line 117, in _extract_text_from_page return page.extract_text( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pypdf/_page.py", line 2102, in extract_text return self._extract_text( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pypdf/_page.py", line 1823, in _extract_text for operands, operator in content.operations: ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1265, in operations self._parse_content_stream(BytesIO(b_(self._data))) File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1171, in _parse_content_stream operands.append(read_object(stream, None, self.forced_encoding)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pypdf/generic/_data_structures.py", line 1340, in read_object raise PdfReadError( pypdf.errors.PdfReadError: Invalid Elementary Object starting with b'\xc1' @0: b'\xc1\xd0\nq\n5 0 0 5 12 26 cm\n/WaZ1Ovl69HCArOV3 Do\nQ\nq\n5 0 0 5 12 20 cm\n/W1ZDOklB9oCDrMV' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/backend/open_webui/apps/webui/routers/files.py", line 71, in upload_file process_file(ProcessFileForm(file_id=id)) File "/app/backend/open_webui/apps/retrieval/main.py", line 903, in process_file raise HTTPException( fastapi.exceptions.HTTPException: 400: Invalid Elementary Object starting with b'\xc1' @0: b'\xc1\xd0\nq\n5 0 0 5 12 26 cm\n/WaZ1Ovl69HCArOV3 Do\nQ\nq\n5 0 0 5 12 20 cm\n/W1ZDOklB9oCDrMV' ERROR [open_webui.apps.webui.routers.files] Error processing file: c07370c2-5dfe-4cc1-8a38-0060fca2513b ``` ## Additional Information I guess this https://github.com/open-webui/open-webui/issues/6844 may help resolve the issue.
Author
Owner

@hongbo-miao commented on GitHub (Nov 13, 2024):

I found a workaround way, re-save the PDF file by macOS Preview, and then re-uploading works.
But I think it would be still better to find a way to resolve the parsing issue. ☺️

<!-- gh-comment-id:2474994626 --> @hongbo-miao commented on GitHub (Nov 13, 2024): I found a workaround way, re-save the PDF file by macOS Preview, and then re-uploading works. But I think it would be still better to find a way to resolve the parsing issue. ☺️
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#134262