I have searched the existing issues and discussions.
Problem Description
When I uplode image with endpoint API, the problem occurred:
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/text.py", line 43, in lazy_load
text = f.read()
│ └ <method 'read' of '_io.TextIOWrapper' objects>
└ <_io.TextIOWrapper name='/app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png' mode='r' encoding='UTF-8'>
File "", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x7fb641c64860>
└ <WorkerThread(AnyIO worker thread, started 140419765601984)>
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x7fb60cbe8540>
└ <WorkerThread(AnyIO worker thread, started 140419765601984)>
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function upload_file at 0x7fb61858c680>, user=UserModel(id='5670136a-7b47-4cd2-831c-7f2364dec134', name='E...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x7fb60b372440>
File "/app/backend/open_webui/routers/files.py", line 85, in upload_file
process_file(request, ProcessFileForm(file_id=id), user=user)
│ │ │ │ └ UserModel(id='5670136a-7b47-4cd2-831c-7f2364dec134', name='EthanLu', email='mail@lutong.space', role='admin', profile_image_u...
│ │ │ └ '7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a'
│ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
│ └ <starlette.requests.Request object at 0x7fb60b3d2a10>
└ <function process_file at 0x7fb6152198a0>
File "/app/backend/open_webui/routers/retrieval.py", line 997, in process_file
docs = loader.load(
│ └ <function Loader.load at 0x7fb6162f42c0>
└ <open_webui.retrieval.loaders.main.Loader object at 0x7fb60db362d0>
File "/app/backend/open_webui/retrieval/loaders/main.py", line 129, in load
docs = loader.load()
│ └ <function BaseLoader.load at 0x7fb61707e2a0>
└ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 32, in load
return list(self.lazy_load())
│ └ <function TextLoader.lazy_load at 0x7fb6162cec00>
└ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/text.py", line 46, in lazy_load
detected_encodings = detect_file_encodings(self.file_path)
│ │ └ '/app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png'
│ └ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
└ <function detect_file_encodings at 0x7fb6165e5620>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/helpers.py", line 50, in detect_file_encodings
raise RuntimeError(f"Could not detect encoding for {file_path}")
RuntimeError: Could not detect encoding for /app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png
2025-04-05 23:51:07.698 | ERROR | open_webui.routers.files:upload_file:89 - 400: Could not detect encoding for /app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png - {}
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/text.py", line 43, in lazy_load
text = f.read()
│ └ <method 'read' of '_io.TextIOWrapper' objects>
└ <_io.TextIOWrapper name='/app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png' mode='r' encoding='UTF-8'>
File "", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/backend/open_webui/routers/retrieval.py", line 997, in process_file
docs = loader.load(
│ └ <function Loader.load at 0x7fb6162f42c0>
└ <open_webui.retrieval.loaders.main.Loader object at 0x7fb60db362d0>
File "/app/backend/open_webui/retrieval/loaders/main.py", line 129, in load
docs = loader.load()
│ └ <function BaseLoader.load at 0x7fb61707e2a0>
└ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 32, in load
return list(self.lazy_load())
│ └ <function TextLoader.lazy_load at 0x7fb6162cec00>
└ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/text.py", line 46, in lazy_load
detected_encodings = detect_file_encodings(self.file_path)
│ │ └ '/app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png'
│ └ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
└ <function detect_file_encodings at 0x7fb6165e5620>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/helpers.py", line 50, in detect_file_encodings
raise RuntimeError(f"Could not detect encoding for {file_path}")
RuntimeError: Could not detect encoding for /app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x7fb641c64860>
└ <WorkerThread(AnyIO worker thread, started 140419765601984)>
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x7fb60cbe8540>
└ <WorkerThread(AnyIO worker thread, started 140419765601984)>
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function upload_file at 0x7fb61858c680>, user=UserModel(id='5670136a-7b47-4cd2-831c-7f2364dec134', name='E...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x7fb60b372440>
File "/app/backend/open_webui/routers/files.py", line 85, in upload_file
process_file(request, ProcessFileForm(file_id=id), user=user)
│ │ │ │ └ UserModel(id='5670136a-7b47-4cd2-831c-7f2364dec134', name='EthanLu', email='mail@lutong.space', role='admin', profile_image_u...
│ │ │ └ '7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a'
│ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
│ └ <starlette.requests.Request object at 0x7fb60b3d2a10>
└ <function process_file at 0x7fb6152198a0>
File "/app/backend/open_webui/routers/retrieval.py", line 1085, in process_file
raise HTTPException(
└ <class 'fastapi.exceptions.HTTPException'>
Desired Solution you'd like
I intend to utilize the endpoint API for image uploads to leverage Open WebUI's image compression feature, thereby reducing token usage. However, I have discovered that the endpoint API does not support image uploads.
Alternatives Considered
No response
Additional Context
No response
Originally created by @EthantLu on GitHub (Apr 5, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12483
### Check Existing Issues
- [x] I have searched the existing issues and discussions.
### Problem Description
When I uplode image with endpoint API, the problem occurred:
---
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/text.py", line 43, in lazy_load
text = f.read()
│ └ <method 'read' of '_io.TextIOWrapper' objects>
└ <_io.TextIOWrapper name='/app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png' mode='r' encoding='UTF-8'>
File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x7fb641c64860>
└ <WorkerThread(AnyIO worker thread, started 140419765601984)>
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x7fb60cbe8540>
└ <WorkerThread(AnyIO worker thread, started 140419765601984)>
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function upload_file at 0x7fb61858c680>, user=UserModel(id='5670136a-7b47-4cd2-831c-7f2364dec134', name='E...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x7fb60b372440>
File "/app/backend/open_webui/routers/files.py", line 85, in upload_file
process_file(request, ProcessFileForm(file_id=id), user=user)
│ │ │ │ └ UserModel(id='5670136a-7b47-4cd2-831c-7f2364dec134', name='EthanLu', email='mail@lutong.space', role='admin', profile_image_u...
│ │ │ └ '7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a'
│ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
│ └ <starlette.requests.Request object at 0x7fb60b3d2a10>
└ <function process_file at 0x7fb6152198a0>
> File "/app/backend/open_webui/routers/retrieval.py", line 997, in process_file
docs = loader.load(
│ └ <function Loader.load at 0x7fb6162f42c0>
└ <open_webui.retrieval.loaders.main.Loader object at 0x7fb60db362d0>
File "/app/backend/open_webui/retrieval/loaders/main.py", line 129, in load
docs = loader.load()
│ └ <function BaseLoader.load at 0x7fb61707e2a0>
└ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 32, in load
return list(self.lazy_load())
│ └ <function TextLoader.lazy_load at 0x7fb6162cec00>
└ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/text.py", line 46, in lazy_load
detected_encodings = detect_file_encodings(self.file_path)
│ │ └ '/app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png'
│ └ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
└ <function detect_file_encodings at 0x7fb6165e5620>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/helpers.py", line 50, in detect_file_encodings
raise RuntimeError(f"Could not detect encoding for {file_path}")
RuntimeError: Could not detect encoding for /app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png
2025-04-05 23:51:07.698 | ERROR | open_webui.routers.files:upload_file:89 - 400: Could not detect encoding for /app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png - {}
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/text.py", line 43, in lazy_load
text = f.read()
│ └ <method 'read' of '_io.TextIOWrapper' objects>
└ <_io.TextIOWrapper name='/app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png' mode='r' encoding='UTF-8'>
File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/backend/open_webui/routers/retrieval.py", line 997, in process_file
docs = loader.load(
│ └ <function Loader.load at 0x7fb6162f42c0>
└ <open_webui.retrieval.loaders.main.Loader object at 0x7fb60db362d0>
File "/app/backend/open_webui/retrieval/loaders/main.py", line 129, in load
docs = loader.load()
│ └ <function BaseLoader.load at 0x7fb61707e2a0>
└ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 32, in load
return list(self.lazy_load())
│ └ <function TextLoader.lazy_load at 0x7fb6162cec00>
└ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/text.py", line 46, in lazy_load
detected_encodings = detect_file_encodings(self.file_path)
│ │ └ '/app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png'
│ └ <langchain_community.document_loaders.text.TextLoader object at 0x7fb6141b4090>
└ <function detect_file_encodings at 0x7fb6165e5620>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/helpers.py", line 50, in detect_file_encodings
raise RuntimeError(f"Could not detect encoding for {file_path}")
RuntimeError: Could not detect encoding for /app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x7fb641c64860>
└ <WorkerThread(AnyIO worker thread, started 140419765601984)>
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x7fb60cbe8540>
└ <WorkerThread(AnyIO worker thread, started 140419765601984)>
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function upload_file at 0x7fb61858c680>, user=UserModel(id='5670136a-7b47-4cd2-831c-7f2364dec134', name='E...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x7fb60b372440>
> File "/app/backend/open_webui/routers/files.py", line 85, in upload_file
process_file(request, ProcessFileForm(file_id=id), user=user)
│ │ │ │ └ UserModel(id='5670136a-7b47-4cd2-831c-7f2364dec134', name='EthanLu', email='mail@lutong.space', role='admin', profile_image_u...
│ │ │ └ '7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a'
│ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
│ └ <starlette.requests.Request object at 0x7fb60b3d2a10>
└ <function process_file at 0x7fb6152198a0>
File "/app/backend/open_webui/routers/retrieval.py", line 1085, in process_file
raise HTTPException(
└ <class 'fastapi.exceptions.HTTPException'>
### Desired Solution you'd like
I intend to utilize the endpoint API for image uploads to leverage Open WebUI's image compression feature, thereby reducing token usage. However, I have discovered that the endpoint API does not support image uploads.
### Alternatives Considered
_No response_
### Additional Context
_No response_
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 @EthantLu on GitHub (Apr 5, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12483
Check Existing Issues
Problem Description
When I uplode image with endpoint API, the problem occurred:
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/text.py", line 43, in lazy_load
text = f.read()
│ └ <method 'read' of '_io.TextIOWrapper' objects>
└ <_io.TextIOWrapper name='/app/backend/data/uploads/7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a_2.png' mode='r' encoding='UTF-8'>
File "", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x7fb641c64860>
└ <WorkerThread(AnyIO worker thread, started 140419765601984)>
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x7fb60cbe8540>
└ <WorkerThread(AnyIO worker thread, started 140419765601984)>
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function upload_file at 0x7fb61858c680>, user=UserModel(id='5670136a-7b47-4cd2-831c-7f2364dec134', name='E...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x7fb60b372440>
File "/app/backend/open_webui/routers/files.py", line 85, in upload_file
process_file(request, ProcessFileForm(file_id=id), user=user)
│ │ │ │ └ UserModel(id='5670136a-7b47-4cd2-831c-7f2364dec134', name='EthanLu', email='mail@lutong.space', role='admin', profile_image_u...
│ │ │ └ '7c7f82be-dda3-47b1-9c11-19a0cb8a2d4a'
│ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
│ └ <starlette.requests.Request object at 0x7fb60b3d2a10>
└ <function process_file at 0x7fb6152198a0>
Desired Solution you'd like
I intend to utilize the endpoint API for image uploads to leverage Open WebUI's image compression feature, thereby reducing token usage. However, I have discovered that the endpoint API does not support image uploads.
Alternatives Considered
No response
Additional Context
No response