[GH-ISSUE #17000] issue: Special characters in file names cause errors, when a custom document extraction engine is setup #88872

Closed
opened 2026-05-15 13:40:38 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @BakirBukvic on GitHub (Aug 28, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/17000

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

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

  • I have read and followed all instructions in README.md.
  • I am using 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 every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

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

  1. Setup using docker
  2. Use a custom file engine extractor ( Or any extractor that requires you to send it via HTTP, instead of doing it internally )
  3. Send a file that has special characters in it's name: (ü.pdf”)

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

response = requests.put(f"{url}/process", data=data, headers=headers)

           │        │                          │             └ {'Content-Type': 'application/pdf', 'Authorization': 'Bearer CCMURt3K92CdmI-mA0vSviCX10Fd_qlbWzjPbTimqWg', 'X-Filename': '864...

           │        │                          └ b'%PDF-1.4\n%\xd3\xeb\xe9\xe1\n1 0 obj\n<</Title <FEFF004100490049004100202013002000450069006E006600FC006800720075006E0067002...

           │        └ <function put at 0x797fc38380e0>

           └ <module 'requests' from '/usr/local/lib/python3.11/site-packages/requests/__init__.py'>

File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 130, in put

return request("put", url, data=data, **kwargs)

       │              │         │       └ {'headers': {'Content-Type': 'application/pdf', 'Authorization': 'Bearer CCMURt3K92CdmI-mA0vSviCX10Fd_qlbWzjPbTimqWg', 'X-Fil...

       │              │         └ b'%PDF-1.4\n%\xd3\xeb\xe9\xe1\n1 0 obj\n<</Title <FEFF004100490049004100202013002000450069006E006600FC006800720075006E0067002...

       │              └ 'https://e88f8741675b.ngrok-free.app/process'

       └ <function request at 0x797fc37f6fc0>

File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request

return session.request(method=method, url=url, **kwargs)

       │       │              │           │      └ {'data': b'%PDF-1.4\n%\xd3\xeb\xe9\xe1\n1 0 obj\n<</Title <FEFF004100490049004100202013002000450069006E006600FC00680072007500...

       │       │              │           └ 'https://e88f8741675b.ngrok-free.app/process'

       │       │              └ 'put'

       │       └ <function Session.request at 0x797fc38334c0>

       └ <requests.sessions.Session object at 0x797f6547a2d0>

File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request

resp = self.send(prep, **send_kwargs)

       │    │    │       └ {'timeout': None, 'allow_redirects': True, 'proxies': OrderedDict(), 'stream': False, 'verify': True, 'cert': None}

       │    │    └ <PreparedRequest [PUT]>

       │    └ <function Session.send at 0x797fc38339c0>

       └ <requests.sessions.Session object at 0x797f6547a2d0>

File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send

r = adapter.send(request, **kwargs)

    │       │    │          └ {'timeout': None, 'proxies': OrderedDict(), 'stream': False, 'verify': True, 'cert': None}

    │       │    └ <PreparedRequest [PUT]>

    │       └ <function HTTPAdapter.send at 0x797fc3832d40>

    └ <requests.adapters.HTTPAdapter object at 0x797f5442e490>

File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 667, in send

resp = conn.urlopen(

       │    └ <function HTTPConnectionPool.urlopen at 0x797fc3b31bc0>

       └ <urllib3.connectionpool.HTTPSConnectionPool object at 0x797f659e0ed0>

File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen

response = self._make_request(

           │    └ <function HTTPConnectionPool._make_request at 0x797fc3b319e0>

           └ <urllib3.connectionpool.HTTPSConnectionPool object at 0x797f659e0ed0>

File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 493, in _make_request

conn.request(

│    └ <function HTTPConnection.request at 0x797fc3b094e0>

└ <urllib3.connection.HTTPSConnection object at 0x797f378eb410>

File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 493, in request

self.putheader(header, value)

│    │         │       └ '86413b70-97ea-47f0-89e2-edec1e2b6b7b_FILE_NAME_REDACTED.pdf'

│    │         └ 'X-Filename'

│    └ <function HTTPConnection.putheader at 0x797fc3b09440>

└ <urllib3.connection.HTTPSConnection object at 0x797f378eb410>

File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 407, in putheader

super().putheader(header, *values)

                  │        └ ('86413b70-97ea-47f0-89e2-edec1e2b6b7b_FILE_NAME_REDACTED.pdf',)

                  └ 'X-Filename'

File "/usr/local/lib/python3.11/http/client.py", line 1276, in putheader

values[i] = one_value.encode('latin-1')

│      │    │         └ <method 'encode' of 'str' objects>

│      │    └ '86413b70-97ea-47f0-89e2-edec1e2b6b7b_FILE_NAME_REDACTED.pdf'

│      └ 0

└ ['86413b70-97ea-47f0-89e2-edec1e2b6b7b_FILE_NAME_REDACTED.pdf']

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

docs = loader.load(

       │      └ <function Loader.load at 0x797f96bd9080>

       └ <open_webui.retrieval.loaders.main.Loader object at 0x797f541e3b90>

File "/app/backend/open_webui/retrieval/loaders/main.py", line 218, in load

docs = loader.load()

       │      └ <function ExternalDocumentLoader.load at 0x797f96c3f4c0>

       └ <open_webui.retrieval.loaders.external_document.ExternalDocumentLoader object at 0x797f654d7290>

File "/app/backend/open_webui/retrieval/loaders/external_document.py", line 52, in load

raise Exception(f"Error connecting to endpoint: {e}")

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

self._bootstrap_inner()

│    └ <function Thread._bootstrap_inner at 0x797fc705c9a0>

└ <WorkerThread(AnyIO worker thread, started 133587271632576)>

File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner

self.run()

│    └ <function WorkerThread.run at 0x797f655d2f20>

└ <WorkerThread(AnyIO worker thread, started 133587271632576)>

File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run

result = context.run(func, *args)

         │       │   │      └ ()

         │       │   └ functools.partial(<function upload_file at 0x797f98f43420>, user=UserModel(id='0973ff1d-5239-4d16-adaf-e25a55d8d593', name='B...

         │       └ <method 'run' of '_contextvars.Context' objects>

         └ <_contextvars.Context object at 0x797f378ea780>

File "/app/backend/open_webui/routers/files.py", line 183, in upload_file

process_file(request, ProcessFileForm(file_id=id), user=user)

│            │        │                       │         └ UserModel(id='0973ff1d-5239-4d16-adaf-e25a55d8d593', name='Bakir Bukvic', email='bakibakirbax@gmail.com', role='admin', profi...

│            │        │                       └ '86413b70-97ea-47f0-89e2-edec1e2b6b7b'

│            │        └ <class 'open_webui.routers.retrieval.ProcessFileForm'>

│            └ <starlette.requests.Request object at 0x797f3776db50>

└ <function process_file at 0x797f95fb7a60>

File "/app/backend/open_webui/routers/retrieval.py", line 1526, in process_file

raise HTTPException(

      └ <class 'fastapi.exceptions.HTTPException'>

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

Originally created by @BakirBukvic on GitHub (Aug 28, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/17000 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [ ] I am using the latest version of Open WebUI. ### 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 - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [ ] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### 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 1. Setup using docker 2. Use a custom file engine extractor ( Or any extractor that requires you to send it via HTTP, instead of doing it internally ) 3. Send a file that has special characters in it's name: (ü.pdf”) ### 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 response = requests.put(f"{url}/process", data=data, headers=headers) │ │ │ └ {'Content-Type': 'application/pdf', 'Authorization': 'Bearer CCMURt3K92CdmI-mA0vSviCX10Fd_qlbWzjPbTimqWg', 'X-Filename': '864... │ │ └ b'%PDF-1.4\n%\xd3\xeb\xe9\xe1\n1 0 obj\n<</Title <FEFF004100490049004100202013002000450069006E006600FC006800720075006E0067002... │ └ <function put at 0x797fc38380e0> └ <module 'requests' from '/usr/local/lib/python3.11/site-packages/requests/__init__.py'> File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 130, in put return request("put", url, data=data, **kwargs) │ │ │ └ {'headers': {'Content-Type': 'application/pdf', 'Authorization': 'Bearer CCMURt3K92CdmI-mA0vSviCX10Fd_qlbWzjPbTimqWg', 'X-Fil... │ │ └ b'%PDF-1.4\n%\xd3\xeb\xe9\xe1\n1 0 obj\n<</Title <FEFF004100490049004100202013002000450069006E006600FC006800720075006E0067002... │ └ 'https://e88f8741675b.ngrok-free.app/process' └ <function request at 0x797fc37f6fc0> File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) │ │ │ │ └ {'data': b'%PDF-1.4\n%\xd3\xeb\xe9\xe1\n1 0 obj\n<</Title <FEFF004100490049004100202013002000450069006E006600FC00680072007500... │ │ │ └ 'https://e88f8741675b.ngrok-free.app/process' │ │ └ 'put' │ └ <function Session.request at 0x797fc38334c0> └ <requests.sessions.Session object at 0x797f6547a2d0> File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) │ │ │ └ {'timeout': None, 'allow_redirects': True, 'proxies': OrderedDict(), 'stream': False, 'verify': True, 'cert': None} │ │ └ <PreparedRequest [PUT]> │ └ <function Session.send at 0x797fc38339c0> └ <requests.sessions.Session object at 0x797f6547a2d0> File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) │ │ │ └ {'timeout': None, 'proxies': OrderedDict(), 'stream': False, 'verify': True, 'cert': None} │ │ └ <PreparedRequest [PUT]> │ └ <function HTTPAdapter.send at 0x797fc3832d40> └ <requests.adapters.HTTPAdapter object at 0x797f5442e490> File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( │ └ <function HTTPConnectionPool.urlopen at 0x797fc3b31bc0> └ <urllib3.connectionpool.HTTPSConnectionPool object at 0x797f659e0ed0> File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen response = self._make_request( │ └ <function HTTPConnectionPool._make_request at 0x797fc3b319e0> └ <urllib3.connectionpool.HTTPSConnectionPool object at 0x797f659e0ed0> File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 493, in _make_request conn.request( │ └ <function HTTPConnection.request at 0x797fc3b094e0> └ <urllib3.connection.HTTPSConnection object at 0x797f378eb410> File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 493, in request self.putheader(header, value) │ │ │ └ '86413b70-97ea-47f0-89e2-edec1e2b6b7b_FILE_NAME_REDACTED.pdf' │ │ └ 'X-Filename' │ └ <function HTTPConnection.putheader at 0x797fc3b09440> └ <urllib3.connection.HTTPSConnection object at 0x797f378eb410> File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 407, in putheader super().putheader(header, *values) │ └ ('86413b70-97ea-47f0-89e2-edec1e2b6b7b_FILE_NAME_REDACTED.pdf',) └ 'X-Filename' File "/usr/local/lib/python3.11/http/client.py", line 1276, in putheader values[i] = one_value.encode('latin-1') │ │ │ └ <method 'encode' of 'str' objects> │ │ └ '86413b70-97ea-47f0-89e2-edec1e2b6b7b_FILE_NAME_REDACTED.pdf' │ └ 0 └ ['86413b70-97ea-47f0-89e2-edec1e2b6b7b_FILE_NAME_REDACTED.pdf'] 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 docs = loader.load( │ └ <function Loader.load at 0x797f96bd9080> └ <open_webui.retrieval.loaders.main.Loader object at 0x797f541e3b90> File "/app/backend/open_webui/retrieval/loaders/main.py", line 218, in load docs = loader.load() │ └ <function ExternalDocumentLoader.load at 0x797f96c3f4c0> └ <open_webui.retrieval.loaders.external_document.ExternalDocumentLoader object at 0x797f654d7290> File "/app/backend/open_webui/retrieval/loaders/external_document.py", line 52, in load raise Exception(f"Error connecting to endpoint: {e}") 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 self._bootstrap_inner() │ └ <function Thread._bootstrap_inner at 0x797fc705c9a0> └ <WorkerThread(AnyIO worker thread, started 133587271632576)> File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x797f655d2f20> └ <WorkerThread(AnyIO worker thread, started 133587271632576)> File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run result = context.run(func, *args) │ │ │ └ () │ │ └ functools.partial(<function upload_file at 0x797f98f43420>, user=UserModel(id='0973ff1d-5239-4d16-adaf-e25a55d8d593', name='B... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x797f378ea780> > File "/app/backend/open_webui/routers/files.py", line 183, in upload_file process_file(request, ProcessFileForm(file_id=id), user=user) │ │ │ │ └ UserModel(id='0973ff1d-5239-4d16-adaf-e25a55d8d593', name='Bakir Bukvic', email='bakibakirbax@gmail.com', role='admin', profi... │ │ │ └ '86413b70-97ea-47f0-89e2-edec1e2b6b7b' │ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'> │ └ <starlette.requests.Request object at 0x797f3776db50> └ <function process_file at 0x797f95fb7a60> File "/app/backend/open_webui/routers/retrieval.py", line 1526, in process_file raise HTTPException( └ <class 'fastapi.exceptions.HTTPException'> 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_
GiteaMirror added the bug label 2026-05-15 13:40:38 -05:00
Author
Owner

@tjbck commented on GitHub (Sep 1, 2025):

Addressed in dev #17013

<!-- gh-comment-id:3243090637 --> @tjbck commented on GitHub (Sep 1, 2025): Addressed in dev #17013
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#88872