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.

**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.
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. ☺️
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.
However,
ISO 15118-2.pdffailed.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:
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:
Logs and Screenshots
Browser Console Logs:
Docker Container Logs:
Additional Information
I guess this https://github.com/open-webui/open-webui/issues/6844 may help resolve the issue.
@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. ☺️