[GH-ISSUE #14375] issue: UnicodeEncodeError when uploading files with non-ASCII user names and ENABLE_FORWARD_USER_INFO_HEADERS enabled #55891

Closed
opened 2026-05-05 18:14:24 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @dulicon on GitHub (May 27, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/14375

Check Existing Issues

  • I have searched the existing issues and discussions.

Problem Description

When a user's name is registered in Korean (or other non-Latin characters), file upload operations fail with a UnicodeEncodeError. The error occurs in the embedding generation process when the ENABLE_FORWARD_USER_INFO_HEADERS setting is enabled.

Error Details:

UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256)

Root Cause:
The issue stems from the HTTP header encoding limitation where the X-OpenWebUI-User-Name header is set with non-ASCII characters (Korean name "테스터" in this case). HTTP headers must be encoded in Latin-1, but Korean characters cannot be represented in this encoding scheme.

Steps to Reproduce:

  1. Enable ENABLE_FORWARD_USER_INFO_HEADERS setting
  2. Register a user with a Korean name (e.g., "테스터")
  3. Attempt to upload a file
  4. The operation fails with the Unicode encoding error

Error Stack Trace Key Points:

  • Error occurs in urllib3/connection.py at line 358: super().putheader(header, *values)
  • The header X-OpenWebUI-User-Name contains Korean characters that cannot be encoded in Latin-1
  • This causes a cascading failure in the embedding generation process

Desired Solution you'd like

Primary Solution:
Fix the Unicode encoding issue by implementing proper encoding for non-ASCII characters in HTTP headers. The system should handle international character sets in user names when setting the X-OpenWebUI-User-Name header value. Please investigate appropriate encoding methods that comply with HTTP header standards while preserving the original user name information.

Alternative Solution:
If the primary fix is complex to implement, provide more granular control over the ENABLE_FORWARD_USER_INFO_HEADERS setting by adding a new configuration option that allows users to specify which headers to forward:

FORWARD_USER_INFO_HEADERS = ["X-OpenWebUI-User-ID", "X-OpenWebUI-User-Email"]  # Exclude User-Name

This would allow users to forward user information without including problematic headers that contain non-ASCII characters.

Expected Behavior:

  • Users with non-ASCII names should be able to upload files without encountering encoding errors
  • The user information should be properly forwarded to downstream services when the header forwarding feature is enabled
  • The system should gracefully handle international character sets in user names

Alternatives Considered

No response

Additional Context

Server logs when the error occurred are attached below for reference.

2025-05-27 04:40:04.356 | INFO     | open_webui.routers.retrieval:save_docs_to_vector_db:969 - save_docs_to_vector_db: document test_file.txt file-3af74a83-b492-442a-87d7-bd2e00dc3e2b - {}
2025-05-27 04:40:04.370 | INFO     | open_webui.routers.retrieval:save_docs_to_vector_db:1052 - adding to collection file-3af74a83-b492-442a-87d7-bd2e00dc3e2b - {}
2025-05-27 04:40:04.375 | ERROR    | open_webui.retrieval.utils:generate_openai_batch_embeddings:696 - Error generating openai batch embeddings: 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256) - {}
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 0x7f2a8faf8860>
    └ <WorkerThread(AnyIO worker thread, started 139818935760576)>
  File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
    │    └ <function WorkerThread.run at 0x7f2a2c995760>
    └ <WorkerThread(AnyIO worker thread, started 139818935760576)>
  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 0x7f2a39c76f20>, user=UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테...
             │       └ <method 'run' of '_contextvars.Context' objects>
             └ <_contextvars.Context object at 0x7f2a2b1f7bc0>

  File "/app/backend/open_webui/routers/files.py", line 172, in upload_file
    process_file(request, ProcessFileForm(file_id=id), user=user)
    │            │        │                       │         └ UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테스터', email='hun8297@gmail.com', role='user', profile_image_url='d...
    │            │        │                       └ '3af74a83-b492-442a-87d7-bd2e00dc3e2b'
    │            │        └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
    │            └ <starlette.requests.Request object at 0x7f2a2b9a6b10>
    └ <function process_file at 0x7f2a31fa47c0>

  File "/app/backend/open_webui/routers/retrieval.py", line 1236, in process_file
    result = save_docs_to_vector_db(
             └ <function save_docs_to_vector_db at 0x7f2a31f23ce0>

  File "/app/backend/open_webui/routers/retrieval.py", line 1070, in save_docs_to_vector_db
    embeddings = embedding_function(
                 └ <function get_embedding_function.<locals>.<lambda> at 0x7f2a2b130900>

  File "/app/backend/open_webui/retrieval/utils.py", line 434, in <lambda>
    return lambda query, prefix=None, user=None: generate_multiple(
                  │                              └ <function get_embedding_function.<locals>.generate_multiple at 0x7f2a2b133600>
                  └ ['출근은 7시 ~ 11시까지만 인정됩니다.']

  File "/app/backend/open_webui/retrieval/utils.py", line 424, in generate_multiple
    func(
    └ <function get_embedding_function.<locals>.<lambda> at 0x7f2a2b9b6980>

  File "/app/backend/open_webui/retrieval/utils.py", line 409, in <lambda>
    func = lambda query, prefix=None, user=None: generate_embeddings(
                  │                              └ <function generate_embeddings at 0x7f2a31fa4ea0>
                  └ ['출근은 7시 ~ 11시까지만 인정됩니다.']

  File "/app/backend/open_webui/retrieval/utils.py", line 789, in generate_embeddings
    embeddings = generate_openai_batch_embeddings(
                 └ <function generate_openai_batch_embeddings at 0x7f2a31fa4cc0>

> File "/app/backend/open_webui/retrieval/utils.py", line 671, in generate_openai_batch_embeddings
    r = requests.post(
        │        └ <function post at 0x7f2a8c3f8d60>
        └ <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 115, in post
    return request("post", url, data=data, json=json, **kwargs)
           │               │         │          │       └ {'headers': {'Content-Type': 'application/json', 'Authorization': 'Bearer 1', 'X-OpenWebUI-User-Name': '테스터', 'X-OpenWebUI-Us...
           │               │         │          └ {'input': ['출근은 7시 ~ 11시까지만 인정됩니다.'], 'model': 'text-embedding-3-small'}
           │               │         └ None
           │               └ 'http://litellm:4000/embeddings'
           └ <function request at 0x7f2a8c3ba340>
  File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           │       │              │           │      └ {'data': None, 'json': {'input': ['출근은 7시 ~ 11시까지만 인정됩니다.'], 'model': 'text-embedding-3-small'}, 'headers': {'Content-Type': ...
           │       │              │           └ 'http://litellm:4000/embeddings'
           │       │              └ 'post'
           │       └ <function Session.request at 0x7f2a8c3f8220>
           └ <requests.sessions.Session object at 0x7f2a2b5c9850>
  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 [POST]>
           │    └ <function Session.send at 0x7f2a8c3f8720>
           └ <requests.sessions.Session object at 0x7f2a2b5c9850>
  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 [POST]>
        │       └ <function HTTPAdapter.send at 0x7f2a8c3efa60>
        └ <requests.adapters.HTTPAdapter object at 0x7f2a2ad1f810>
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           │    └ <function HTTPConnectionPool.urlopen at 0x7f2a8c6ea8e0>
           └ <urllib3.connectionpool.HTTPConnectionPool object at 0x7f2a2b990f90>
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
               │    └ <function HTTPConnectionPool._make_request at 0x7f2a8c6ea700>
               └ <urllib3.connectionpool.HTTPConnectionPool object at 0x7f2a2b990f90>
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 493, in _make_request
    conn.request(
    │    └ <function HTTPConnection.request at 0x7f2a8c6c2200>
    └ <urllib3.connection.HTTPConnection object at 0x7f2a2ad27b90>
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 444, in request
    self.putheader(header, value)
    │    │         │       └ '테스터'
    │    │         └ 'X-OpenWebUI-User-Name'
    │    └ <function HTTPConnection.putheader at 0x7f2a8c6c2160>
    └ <urllib3.connection.HTTPConnection object at 0x7f2a2ad27b90>
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 358, in putheader
    super().putheader(header, *values)
                      │        └ ('테스터',)
                      └ 'X-OpenWebUI-User-Name'
  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>
    │      │    └ '테스터'
    │      └ 0
    └ ['테스터']

UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256)
2025-05-27 04:40:04.380 | ERROR    | open_webui.routers.retrieval:save_docs_to_vector_db:1093 - 'NoneType' object is not iterable - {}
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 0x7f2a8faf8860>
    └ <WorkerThread(AnyIO worker thread, started 139818935760576)>
  File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
    │    └ <function WorkerThread.run at 0x7f2a2c995760>
    └ <WorkerThread(AnyIO worker thread, started 139818935760576)>
  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 0x7f2a39c76f20>, user=UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테...
             │       └ <method 'run' of '_contextvars.Context' objects>
             └ <_contextvars.Context object at 0x7f2a2b1f7bc0>

  File "/app/backend/open_webui/routers/files.py", line 172, in upload_file
    process_file(request, ProcessFileForm(file_id=id), user=user)
    │            │        │                       │         └ UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테스터', email='hun8297@gmail.com', role='user', profile_image_url='d...
    │            │        │                       └ '3af74a83-b492-442a-87d7-bd2e00dc3e2b'
    │            │        └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
    │            └ <starlette.requests.Request object at 0x7f2a2b9a6b10>
    └ <function process_file at 0x7f2a31fa47c0>

  File "/app/backend/open_webui/routers/retrieval.py", line 1236, in process_file
    result = save_docs_to_vector_db(
             └ <function save_docs_to_vector_db at 0x7f2a31f23ce0>

> File "/app/backend/open_webui/routers/retrieval.py", line 1070, in save_docs_to_vector_db
    embeddings = embedding_function(
                 └ <function get_embedding_function.<locals>.<lambda> at 0x7f2a2b130900>

  File "/app/backend/open_webui/retrieval/utils.py", line 434, in <lambda>
    return lambda query, prefix=None, user=None: generate_multiple(
                  │                              └ <function get_embedding_function.<locals>.generate_multiple at 0x7f2a2b133600>
                  └ ['출근은 7시 ~ 11시까지만 인정됩니다.']

  File "/app/backend/open_webui/retrieval/utils.py", line 423, in generate_multiple
    embeddings.extend(
    │          └ <method 'extend' of 'list' objects>
    └ []

TypeError: 'NoneType' object is not iterable
2025-05-27 04:40:04.381 | ERROR    | open_webui.routers.retrieval:process_file:1274 - 'NoneType' object is not iterable - {}
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 0x7f2a8faf8860>
    └ <WorkerThread(AnyIO worker thread, started 139818935760576)>
  File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
    │    └ <function WorkerThread.run at 0x7f2a2c995760>
    └ <WorkerThread(AnyIO worker thread, started 139818935760576)>
  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 0x7f2a39c76f20>, user=UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테...
             │       └ <method 'run' of '_contextvars.Context' objects>
             └ <_contextvars.Context object at 0x7f2a2b1f7bc0>

  File "/app/backend/open_webui/routers/files.py", line 172, in upload_file
    process_file(request, ProcessFileForm(file_id=id), user=user)
    │            │        │                       │         └ UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테스터', email='hun8297@gmail.com', role='user', profile_image_url='d...
    │            │        │                       └ '3af74a83-b492-442a-87d7-bd2e00dc3e2b'
    │            │        └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
    │            └ <starlette.requests.Request object at 0x7f2a2b9a6b10>
    └ <function process_file at 0x7f2a31fa47c0>

> File "/app/backend/open_webui/routers/retrieval.py", line 1264, in process_file
    raise e
          └ TypeError("'NoneType' object is not iterable")

  File "/app/backend/open_webui/routers/retrieval.py", line 1236, in process_file
    result = save_docs_to_vector_db(
             └ <function save_docs_to_vector_db at 0x7f2a31f23ce0>

  File "/app/backend/open_webui/routers/retrieval.py", line 1094, in save_docs_to_vector_db
    raise e

  File "/app/backend/open_webui/routers/retrieval.py", line 1070, in save_docs_to_vector_db
    embeddings = embedding_function(
                 └ <function get_embedding_function.<locals>.<lambda> at 0x7f2a2b130900>

  File "/app/backend/open_webui/retrieval/utils.py", line 434, in <lambda>
    return lambda query, prefix=None, user=None: generate_multiple(
                  │                              └ <function get_embedding_function.<locals>.generate_multiple at 0x7f2a2b133600>
                  └ ['출근은 7시 ~ 11시까지만 인정됩니다.']

  File "/app/backend/open_webui/retrieval/utils.py", line 423, in generate_multiple
    embeddings.extend(
    │          └ <method 'extend' of 'list' objects>
    └ []

TypeError: 'NoneType' object is not iterable
2025-05-27 04:40:04.382 | ERROR    | open_webui.routers.files:upload_file:181 - 400: 'NoneType' object is not iterable - {}
Traceback (most recent call last):

  File "/app/backend/open_webui/routers/retrieval.py", line 1264, in process_file
    raise e

  File "/app/backend/open_webui/routers/retrieval.py", line 1236, in process_file
    result = save_docs_to_vector_db(
             └ <function save_docs_to_vector_db at 0x7f2a31f23ce0>

  File "/app/backend/open_webui/routers/retrieval.py", line 1094, in save_docs_to_vector_db
    raise e

  File "/app/backend/open_webui/routers/retrieval.py", line 1070, in save_docs_to_vector_db
    embeddings = embedding_function(
                 └ <function get_embedding_function.<locals>.<lambda> at 0x7f2a2b130900>

  File "/app/backend/open_webui/retrieval/utils.py", line 434, in <lambda>
    return lambda query, prefix=None, user=None: generate_multiple(
                  │                              └ <function get_embedding_function.<locals>.generate_multiple at 0x7f2a2b133600>
                  └ ['출근은 7시 ~ 11시까지만 인정됩니다.']

  File "/app/backend/open_webui/retrieval/utils.py", line 423, in generate_multiple
    embeddings.extend(
    │          └ <method 'extend' of 'list' objects>
    └ []

TypeError: 'NoneType' object is not iterable


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 0x7f2a8faf8860>
    └ <WorkerThread(AnyIO worker thread, started 139818935760576)>
  File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
    │    └ <function WorkerThread.run at 0x7f2a2c995760>
    └ <WorkerThread(AnyIO worker thread, started 139818935760576)>
  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 0x7f2a39c76f20>, user=UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테...
             │       └ <method 'run' of '_contextvars.Context' objects>
             └ <_contextvars.Context object at 0x7f2a2b1f7bc0>

> File "/app/backend/open_webui/routers/files.py", line 172, in upload_file
    process_file(request, ProcessFileForm(file_id=id), user=user)
    │            │        │                       │         └ UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테스터', email='hun8297@gmail.com', role='user', profile_image_url='d...
    │            │        │                       └ '3af74a83-b492-442a-87d7-bd2e00dc3e2b'
    │            │        └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
    │            └ <starlette.requests.Request object at 0x7f2a2b9a6b10>
    └ <function process_file at 0x7f2a31fa47c0>

  File "/app/backend/open_webui/routers/retrieval.py", line 1281, in process_file
    raise HTTPException(
          └ <class 'fastapi.exceptions.HTTPException'>

fastapi.exceptions.HTTPException: 400: 'NoneType' object is not iterable
Originally created by @dulicon on GitHub (May 27, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/14375 ### Check Existing Issues - [x] I have searched the existing issues and discussions. ### Problem Description When a user's name is registered in Korean (or other non-Latin characters), file upload operations fail with a `UnicodeEncodeError`. The error occurs in the embedding generation process when the `ENABLE_FORWARD_USER_INFO_HEADERS` setting is enabled. **Error Details:** ``` UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256) ``` **Root Cause:** The issue stems from the HTTP header encoding limitation where the `X-OpenWebUI-User-Name` header is set with non-ASCII characters (Korean name "테스터" in this case). HTTP headers must be encoded in Latin-1, but Korean characters cannot be represented in this encoding scheme. **Steps to Reproduce:** 1. Enable `ENABLE_FORWARD_USER_INFO_HEADERS` setting 2. Register a user with a Korean name (e.g., "테스터") 3. Attempt to upload a file 4. The operation fails with the Unicode encoding error **Error Stack Trace Key Points:** - Error occurs in `urllib3/connection.py` at line 358: `super().putheader(header, *values)` - The header `X-OpenWebUI-User-Name` contains Korean characters that cannot be encoded in Latin-1 - This causes a cascading failure in the embedding generation process ### Desired Solution you'd like **Primary Solution:** Fix the Unicode encoding issue by implementing proper encoding for non-ASCII characters in HTTP headers. The system should handle international character sets in user names when setting the `X-OpenWebUI-User-Name` header value. Please investigate appropriate encoding methods that comply with HTTP header standards while preserving the original user name information. **Alternative Solution:** If the primary fix is complex to implement, provide more granular control over the `ENABLE_FORWARD_USER_INFO_HEADERS` setting by adding a new configuration option that allows users to specify which headers to forward: ```python FORWARD_USER_INFO_HEADERS = ["X-OpenWebUI-User-ID", "X-OpenWebUI-User-Email"] # Exclude User-Name ``` This would allow users to forward user information without including problematic headers that contain non-ASCII characters. **Expected Behavior:** - Users with non-ASCII names should be able to upload files without encountering encoding errors - The user information should be properly forwarded to downstream services when the header forwarding feature is enabled - The system should gracefully handle international character sets in user names ### Alternatives Considered _No response_ ### Additional Context Server logs when the error occurred are attached below for reference. ``` 2025-05-27 04:40:04.356 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:969 - save_docs_to_vector_db: document test_file.txt file-3af74a83-b492-442a-87d7-bd2e00dc3e2b - {} 2025-05-27 04:40:04.370 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1052 - adding to collection file-3af74a83-b492-442a-87d7-bd2e00dc3e2b - {} 2025-05-27 04:40:04.375 | ERROR | open_webui.retrieval.utils:generate_openai_batch_embeddings:696 - Error generating openai batch embeddings: 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256) - {} 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 0x7f2a8faf8860> └ <WorkerThread(AnyIO worker thread, started 139818935760576)> File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x7f2a2c995760> └ <WorkerThread(AnyIO worker thread, started 139818935760576)> 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 0x7f2a39c76f20>, user=UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x7f2a2b1f7bc0> File "/app/backend/open_webui/routers/files.py", line 172, in upload_file process_file(request, ProcessFileForm(file_id=id), user=user) │ │ │ │ └ UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테스터', email='hun8297@gmail.com', role='user', profile_image_url='d... │ │ │ └ '3af74a83-b492-442a-87d7-bd2e00dc3e2b' │ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'> │ └ <starlette.requests.Request object at 0x7f2a2b9a6b10> └ <function process_file at 0x7f2a31fa47c0> File "/app/backend/open_webui/routers/retrieval.py", line 1236, in process_file result = save_docs_to_vector_db( └ <function save_docs_to_vector_db at 0x7f2a31f23ce0> File "/app/backend/open_webui/routers/retrieval.py", line 1070, in save_docs_to_vector_db embeddings = embedding_function( └ <function get_embedding_function.<locals>.<lambda> at 0x7f2a2b130900> File "/app/backend/open_webui/retrieval/utils.py", line 434, in <lambda> return lambda query, prefix=None, user=None: generate_multiple( │ └ <function get_embedding_function.<locals>.generate_multiple at 0x7f2a2b133600> └ ['출근은 7시 ~ 11시까지만 인정됩니다.'] File "/app/backend/open_webui/retrieval/utils.py", line 424, in generate_multiple func( └ <function get_embedding_function.<locals>.<lambda> at 0x7f2a2b9b6980> File "/app/backend/open_webui/retrieval/utils.py", line 409, in <lambda> func = lambda query, prefix=None, user=None: generate_embeddings( │ └ <function generate_embeddings at 0x7f2a31fa4ea0> └ ['출근은 7시 ~ 11시까지만 인정됩니다.'] File "/app/backend/open_webui/retrieval/utils.py", line 789, in generate_embeddings embeddings = generate_openai_batch_embeddings( └ <function generate_openai_batch_embeddings at 0x7f2a31fa4cc0> > File "/app/backend/open_webui/retrieval/utils.py", line 671, in generate_openai_batch_embeddings r = requests.post( │ └ <function post at 0x7f2a8c3f8d60> └ <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 115, in post return request("post", url, data=data, json=json, **kwargs) │ │ │ │ └ {'headers': {'Content-Type': 'application/json', 'Authorization': 'Bearer 1', 'X-OpenWebUI-User-Name': '테스터', 'X-OpenWebUI-Us... │ │ │ └ {'input': ['출근은 7시 ~ 11시까지만 인정됩니다.'], 'model': 'text-embedding-3-small'} │ │ └ None │ └ 'http://litellm:4000/embeddings' └ <function request at 0x7f2a8c3ba340> File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) │ │ │ │ └ {'data': None, 'json': {'input': ['출근은 7시 ~ 11시까지만 인정됩니다.'], 'model': 'text-embedding-3-small'}, 'headers': {'Content-Type': ... │ │ │ └ 'http://litellm:4000/embeddings' │ │ └ 'post' │ └ <function Session.request at 0x7f2a8c3f8220> └ <requests.sessions.Session object at 0x7f2a2b5c9850> 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 [POST]> │ └ <function Session.send at 0x7f2a8c3f8720> └ <requests.sessions.Session object at 0x7f2a2b5c9850> 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 [POST]> │ └ <function HTTPAdapter.send at 0x7f2a8c3efa60> └ <requests.adapters.HTTPAdapter object at 0x7f2a2ad1f810> File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( │ └ <function HTTPConnectionPool.urlopen at 0x7f2a8c6ea8e0> └ <urllib3.connectionpool.HTTPConnectionPool object at 0x7f2a2b990f90> File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen response = self._make_request( │ └ <function HTTPConnectionPool._make_request at 0x7f2a8c6ea700> └ <urllib3.connectionpool.HTTPConnectionPool object at 0x7f2a2b990f90> File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 493, in _make_request conn.request( │ └ <function HTTPConnection.request at 0x7f2a8c6c2200> └ <urllib3.connection.HTTPConnection object at 0x7f2a2ad27b90> File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 444, in request self.putheader(header, value) │ │ │ └ '테스터' │ │ └ 'X-OpenWebUI-User-Name' │ └ <function HTTPConnection.putheader at 0x7f2a8c6c2160> └ <urllib3.connection.HTTPConnection object at 0x7f2a2ad27b90> File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 358, in putheader super().putheader(header, *values) │ └ ('테스터',) └ 'X-OpenWebUI-User-Name' 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> │ │ └ '테스터' │ └ 0 └ ['테스터'] UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256) 2025-05-27 04:40:04.380 | ERROR | open_webui.routers.retrieval:save_docs_to_vector_db:1093 - 'NoneType' object is not iterable - {} 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 0x7f2a8faf8860> └ <WorkerThread(AnyIO worker thread, started 139818935760576)> File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x7f2a2c995760> └ <WorkerThread(AnyIO worker thread, started 139818935760576)> 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 0x7f2a39c76f20>, user=UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x7f2a2b1f7bc0> File "/app/backend/open_webui/routers/files.py", line 172, in upload_file process_file(request, ProcessFileForm(file_id=id), user=user) │ │ │ │ └ UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테스터', email='hun8297@gmail.com', role='user', profile_image_url='d... │ │ │ └ '3af74a83-b492-442a-87d7-bd2e00dc3e2b' │ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'> │ └ <starlette.requests.Request object at 0x7f2a2b9a6b10> └ <function process_file at 0x7f2a31fa47c0> File "/app/backend/open_webui/routers/retrieval.py", line 1236, in process_file result = save_docs_to_vector_db( └ <function save_docs_to_vector_db at 0x7f2a31f23ce0> > File "/app/backend/open_webui/routers/retrieval.py", line 1070, in save_docs_to_vector_db embeddings = embedding_function( └ <function get_embedding_function.<locals>.<lambda> at 0x7f2a2b130900> File "/app/backend/open_webui/retrieval/utils.py", line 434, in <lambda> return lambda query, prefix=None, user=None: generate_multiple( │ └ <function get_embedding_function.<locals>.generate_multiple at 0x7f2a2b133600> └ ['출근은 7시 ~ 11시까지만 인정됩니다.'] File "/app/backend/open_webui/retrieval/utils.py", line 423, in generate_multiple embeddings.extend( │ └ <method 'extend' of 'list' objects> └ [] TypeError: 'NoneType' object is not iterable 2025-05-27 04:40:04.381 | ERROR | open_webui.routers.retrieval:process_file:1274 - 'NoneType' object is not iterable - {} 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 0x7f2a8faf8860> └ <WorkerThread(AnyIO worker thread, started 139818935760576)> File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x7f2a2c995760> └ <WorkerThread(AnyIO worker thread, started 139818935760576)> 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 0x7f2a39c76f20>, user=UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x7f2a2b1f7bc0> File "/app/backend/open_webui/routers/files.py", line 172, in upload_file process_file(request, ProcessFileForm(file_id=id), user=user) │ │ │ │ └ UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테스터', email='hun8297@gmail.com', role='user', profile_image_url='d... │ │ │ └ '3af74a83-b492-442a-87d7-bd2e00dc3e2b' │ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'> │ └ <starlette.requests.Request object at 0x7f2a2b9a6b10> └ <function process_file at 0x7f2a31fa47c0> > File "/app/backend/open_webui/routers/retrieval.py", line 1264, in process_file raise e └ TypeError("'NoneType' object is not iterable") File "/app/backend/open_webui/routers/retrieval.py", line 1236, in process_file result = save_docs_to_vector_db( └ <function save_docs_to_vector_db at 0x7f2a31f23ce0> File "/app/backend/open_webui/routers/retrieval.py", line 1094, in save_docs_to_vector_db raise e File "/app/backend/open_webui/routers/retrieval.py", line 1070, in save_docs_to_vector_db embeddings = embedding_function( └ <function get_embedding_function.<locals>.<lambda> at 0x7f2a2b130900> File "/app/backend/open_webui/retrieval/utils.py", line 434, in <lambda> return lambda query, prefix=None, user=None: generate_multiple( │ └ <function get_embedding_function.<locals>.generate_multiple at 0x7f2a2b133600> └ ['출근은 7시 ~ 11시까지만 인정됩니다.'] File "/app/backend/open_webui/retrieval/utils.py", line 423, in generate_multiple embeddings.extend( │ └ <method 'extend' of 'list' objects> └ [] TypeError: 'NoneType' object is not iterable 2025-05-27 04:40:04.382 | ERROR | open_webui.routers.files:upload_file:181 - 400: 'NoneType' object is not iterable - {} Traceback (most recent call last): File "/app/backend/open_webui/routers/retrieval.py", line 1264, in process_file raise e File "/app/backend/open_webui/routers/retrieval.py", line 1236, in process_file result = save_docs_to_vector_db( └ <function save_docs_to_vector_db at 0x7f2a31f23ce0> File "/app/backend/open_webui/routers/retrieval.py", line 1094, in save_docs_to_vector_db raise e File "/app/backend/open_webui/routers/retrieval.py", line 1070, in save_docs_to_vector_db embeddings = embedding_function( └ <function get_embedding_function.<locals>.<lambda> at 0x7f2a2b130900> File "/app/backend/open_webui/retrieval/utils.py", line 434, in <lambda> return lambda query, prefix=None, user=None: generate_multiple( │ └ <function get_embedding_function.<locals>.generate_multiple at 0x7f2a2b133600> └ ['출근은 7시 ~ 11시까지만 인정됩니다.'] File "/app/backend/open_webui/retrieval/utils.py", line 423, in generate_multiple embeddings.extend( │ └ <method 'extend' of 'list' objects> └ [] TypeError: 'NoneType' object is not iterable 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 0x7f2a8faf8860> └ <WorkerThread(AnyIO worker thread, started 139818935760576)> File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x7f2a2c995760> └ <WorkerThread(AnyIO worker thread, started 139818935760576)> 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 0x7f2a39c76f20>, user=UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x7f2a2b1f7bc0> > File "/app/backend/open_webui/routers/files.py", line 172, in upload_file process_file(request, ProcessFileForm(file_id=id), user=user) │ │ │ │ └ UserModel(id='5b54ebe9-b224-4b81-a5c5-b6ec8364e49a', name='테스터', email='hun8297@gmail.com', role='user', profile_image_url='d... │ │ │ └ '3af74a83-b492-442a-87d7-bd2e00dc3e2b' │ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'> │ └ <starlette.requests.Request object at 0x7f2a2b9a6b10> └ <function process_file at 0x7f2a31fa47c0> File "/app/backend/open_webui/routers/retrieval.py", line 1281, in process_file raise HTTPException( └ <class 'fastapi.exceptions.HTTPException'> fastapi.exceptions.HTTPException: 400: 'NoneType' object is not iterable ```
Author
Owner

@tjbck commented on GitHub (May 27, 2025):

PR welcome.

<!-- gh-comment-id:2911742226 --> @tjbck commented on GitHub (May 27, 2025): PR welcome.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#55891