mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-15 21:19:39 -05:00
[GH-ISSUE #17000] issue: Special characters in file names cause errors, when a custom document extraction engine is setup #33661
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @BakirBukvic on GitHub (Aug 28, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/17000
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.22 - 2025-08-11
Ollama Version (if applicable)
No response
Operating System
Ubuntu 22.04
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
I expect to upload a file and not get an error.
When you have a custom file engine setup, uploading a file with special (non-latin-1) characters in the filename (e.g., “–”), the backend throws a UnicodeEncodeError.
The error occurs when the filename is sent as an HTTP header (X-Filename) during file upload. HTTP headers must be encoded in ISO-8859-1 (latin-1), so any character outside this range causes the upload to fail.
Actual Behavior
You get an error, and you can't upload that file at all
Steps to Reproduce
Logs & Screenshots
2025-08-28 12:37:20.015 | ERROR | open_webui.routers.files:upload_file:192 - 400: Error connecting to endpoint: 'latin-1' codec can't encode character '\u2013' in position 42: ordinal not in range(256)
Traceback (most recent call last):
File "/app/backend/open_webui/retrieval/loaders/external_document.py", line 49, in load
File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 130, in put
File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 667, in send
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 493, in _make_request
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 493, in request
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 407, in putheader
File "/usr/local/lib/python3.11/http/client.py", line 1276, in putheader
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2013' in position 42: ordinal not in range(256)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/backend/open_webui/routers/retrieval.py", line 1438, in process_file
File "/app/backend/open_webui/retrieval/loaders/main.py", line 218, in load
File "/app/backend/open_webui/retrieval/loaders/external_document.py", line 52, in load
Exception: Error connecting to endpoint: 'latin-1' codec can't encode character '\u2013' in position 42: ordinal not in range(256)
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
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run
File "/app/backend/open_webui/routers/retrieval.py", line 1526, in process_file
fastapi.exceptions.HTTPException: 400: Error connecting to endpoint: 'latin-1' codec can't encode character '\u2013' in position 42: ordinal not in range(256)
Additional Information
No response
@tjbck commented on GitHub (Sep 1, 2025):
Addressed in dev #17013