[GH-ISSUE #11355] issue: Knowledge upload file error #119508

Closed
opened 2026-05-20 20:42:56 -05:00 by GiteaMirror · 9 comments
Owner

Originally created by @ouyang7923 on GitHub (Mar 7, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/11355

Check Existing Issues

  • I have searched the existing issues and discussions.

Installation Method

Pip Install

Open WebUI Version

0.5.13-3-g09e2dd9

Ollama Version (if applicable)

No response

Operating System

0.5.13

Browser (if applicable)

edge

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 checked the browser console logs.
  • I have checked the Docker container logs.
  • I have listed steps to reproduce the bug in detail.

Expected Behavior

Upload successfully without exception

Actual Behavior

like this,The document contained only a few hundred words of text

Image

Steps to Reproduce

workspace > knowledge > Create a knowledge base > upload files

Logs & Screenshots

Image

2025-03-07 18:04:04.656 | WARNING | python_multipart.multipart:_internal_write:1401 - Skipping data after last boundary - {}
2025-03-07 18:04:04.659 | INFO | open_webui.routers.files:upload_file:42 - file.content_type: text/plain - {}
2025-03-07 18:04:04.695 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:782 - save_docs_to_vector_db: document data.txt file-420c35a0-aa5e-408b-98b3-747112ce1c0f - {}
2025-03-07 18:04:04.698 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:865 - adding to collection file-420c35a0-aa5e-408b-98b3-747112ce1c0f - {}
2025-03-07 18:04:04.698 | ERROR | open_webui.routers.retrieval:save_docs_to_vector_db:904 - 'NoneType' object has no attribute 'encode' - {}
Traceback (most recent call last):

File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1032, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x000001B05A1CC400>
└ <WorkerThread(AnyIO worker thread, started 21044)>
File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x000001B0412F1120>
└ <WorkerThread(AnyIO worker thread, started 21044)>
File "D:\app\ltw_zj\Python312\Lib\site-packages\anyio_backends_asyncio.py", line 962, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function upload_file at 0x000001B009AE1B20>, user=UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', nam...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x000001B04141B780>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\files.py", line 85, in upload_file
process_file(request, ProcessFileForm(file_id=id), user=user)
│ │ │ │ └ UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', name='oycw', email='ouyang7923@qq.com', role='admin', profile_image_url=...
│ │ │ └ '420c35a0-aa5e-408b-98b3-747112ce1c0f'
│ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
│ └ <starlette.requests.Request object at 0x000001B042654A40>
└ <function process_file at 0x000001B00C8A0680>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1040, in process_file
result = save_docs_to_vector_db(
└ <function save_docs_to_vector_db at 0x000001B00C817100>

File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 883, in save_docs_to_vector_db
embeddings = embedding_function(
└ <function get_embedding_function.. at 0x000001B0426179C0>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\retrieval\utils.py", line 314, in
return lambda query, user=None: embedding_function.encode(query).tolist()
│ │ └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校 、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ...
│ └ None
└ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ...

AttributeError: 'NoneType' object has no attribute 'encode'
2025-03-07 18:04:04.699 | ERROR | open_webui.routers.retrieval:process_file:1078 - 'NoneType' object has no attribute 'encode' - {}
Traceback (most recent call last):

File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1032, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x000001B05A1CC400>
└ <WorkerThread(AnyIO worker thread, started 21044)>
File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x000001B0412F1120>
└ <WorkerThread(AnyIO worker thread, started 21044)>
File "D:\app\ltw_zj\Python312\Lib\site-packages\anyio_backends_asyncio.py", line 962, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function upload_file at 0x000001B009AE1B20>, user=UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', nam...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x000001B04141B780>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\files.py", line 85, in upload_file
process_file(request, ProcessFileForm(file_id=id), user=user)
│ │ │ │ └ UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', name='oycw', email='ouyang7923@qq.com', role='admin', profile_image_url=...
│ │ │ └ '420c35a0-aa5e-408b-98b3-747112ce1c0f'
│ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
│ └ <starlette.requests.Request object at 0x000001B042654A40>
└ <function process_file at 0x000001B00C8A0680>

File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1068, in process_file
raise e
└ AttributeError("'NoneType' object has no attribute 'encode'")
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1040, in process_file
result = save_docs_to_vector_db(
└ <function save_docs_to_vector_db at 0x000001B00C817100>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 905, in save_docs_to_vector_db
raise e
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 883, in save_docs_to_vector_db
embeddings = embedding_function(
└ <function get_embedding_function.. at 0x000001B0426179C0>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\retrieval\utils.py", line 314, in
return lambda query, user=None: embedding_function.encode(query).tolist()
│ │ └ ['小学四年级学生作息时间表 时间段\t���体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校 、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ...
│ └ None
└ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ...

AttributeError: 'NoneType' object has no attribute 'encode'
2025-03-07 18:04:04.701 | ERROR | open_webui.routers.files:upload_file:89 - 400: 'NoneType' object has no attribute 'encode' - {}
Traceback (most recent call last):

File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1068, in process_file
raise e
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1040, in process_file
result = save_docs_to_vector_db(
└ <function save_docs_to_vector_db at 0x000001B00C817100>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 905, in save_docs_to_vector_db
raise e
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 883, in save_docs_to_vector_db
embeddings = embedding_function(
└ <function get_embedding_function.. at 0x000001B0426179C0>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\retrieval\utils.py", line 314, in
return lambda query, user=None: embedding_function.encode(query).tolist()
│ │ └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校 、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ...
│ └ None
└ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ...

AttributeError: 'NoneType' object has no attribute 'encode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1032, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x000001B05A1CC400>
└ <WorkerThread(AnyIO worker thread, started 21044)>
File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x000001B0412F1120>
└ <WorkerThread(AnyIO worker thread, started 21044)>
File "D:\app\ltw_zj\Python312\Lib\site-packages\anyio_backends_asyncio.py", line 962, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function upload_file at 0x000001B009AE1B20>, user=UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', nam...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x000001B04141B780>

File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\files.py", line 85, in upload_file
process_file(request, ProcessFileForm(file_id=id), user=user)
│ │ │ │ └ UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', name='oycw', email='ouyang7923@qq.com', role='admin', profile_image_url=...
│ │ │ └ '420c35a0-aa5e-408b-98b3-747112ce1c0f'
│ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
│ └ <starlette.requests.Request object at 0x000001B042654A40>
└ <function process_file at 0x000001B00C8A0680>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1085, in process_file
raise HTTPException(
└ <class 'fastapi.exceptions.HTTPException'>

fastapi.exceptions.HTTPException: 400: 'NoneType' object has no attribute 'encode'
2025-03-07 18:04:04.705 | ERROR | open_webui.routers.files:upload_file:90 - Error processing file: 420c35a0-aa5e-408b-98b3-747112ce1c0f - {}
2025-03-07 18:04:04.707 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:1855 - "POST /api/v1/files/ HTTP/1.1" 200 - {}
2025-03-07 18:04:04.736 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:782 - save_docs_to_vector_db: document data.txt b6f232cc-c6c9-4757-b0a3-ab857bd04ebe - {}
2025-03-07 18:04:04.738 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:865 - adding to collection b6f232cc-c6c9-4757-b0a3-ab857bd04ebe - {}
2025-03-07 18:04:04.738 | ERROR | open_webui.routers.retrieval:save_docs_to_vector_db:904 - 'NoneType' object has no attribute 'encode' - {}
Traceback (most recent call last):

File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1032, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x000001B05A1CC400>
└ <WorkerThread(AnyIO worker thread, started 18476)>
File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x000001B0412F1120>
└ <WorkerThread(AnyIO worker thread, started 18476)>
File "D:\app\ltw_zj\Python312\Lib\site-packages\anyio_backends_asyncio.py", line 962, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function add_file_to_knowledge_by_id at 0x000001B00DD814E0>, user=UserModel(id='18ec022e-e481-424e-a4bd-7f...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x000001B04135F680>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\knowledge.py", line 291, in add_file_to_knowledge_by_id
process_file(
└ <function process_file at 0x000001B00C8A0680>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1040, in process_file
result = save_docs_to_vector_db(
└ <function save_docs_to_vector_db at 0x000001B00C817100>

File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 883, in save_docs_to_vector_db
embeddings = embedding_function(
└ <function get_embedding_function.. at 0x000001B00B994AE0>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\retrieval\utils.py", line 314, in
return lambda query, user=None: embedding_function.encode(query).tolist()
│ │ └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校 、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ...
│ └ None
└ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ...

AttributeError: 'NoneType' object has no attribute 'encode'
2025-03-07 18:04:04.740 | ERROR | open_webui.routers.retrieval:process_file:1078 - 'NoneType' object has no attribute 'encode' - {}
Traceback (most recent call last):

File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1032, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x000001B05A1CC400>
└ <WorkerThread(AnyIO worker thread, started 18476)>
File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x000001B0412F1120>
└ <WorkerThread(AnyIO worker thread, started 18476)>
File "D:\app\ltw_zj\Python312\Lib\site-packages\anyio_backends_asyncio.py", line 962, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function add_file_to_knowledge_by_id at 0x000001B00DD814E0>, user=UserModel(id='18ec022e-e481-424e-a4bd-7f...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x000001B04135F680>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\knowledge.py", line 291, in add_file_to_knowledge_by_id
process_file(
└ <function process_file at 0x000001B00C8A0680>

File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1068, in process_file
raise e
└ AttributeError("'NoneType' object has no attribute 'encode'")
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1040, in process_file
result = save_docs_to_vector_db(
└ <function save_docs_to_vector_db at 0x000001B00C817100>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 905, in save_docs_to_vector_db
raise e
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 883, in save_docs_to_vector_db
embeddings = embedding_function(
└ <function get_embedding_function.. at 0x000001B00B994AE0>
File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\retrieval\utils.py", line 314, in
return lambda query, user=None: embedding_function.encode(query).tolist()
│ │ └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校 、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ...
│ └ None
└ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ...

AttributeError: 'NoneType' object has no attribute 'encode'
2025-03-07 18:04:04.742 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:1855 - "POST /api/v1/knowledge/b6f232cc-c6c9-4757-b0a3-ab857bd04ebe/file/add HTTP/1.1" 400 - {}

Additional Information

No response

Originally created by @ouyang7923 on GitHub (Mar 7, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/11355 ### Check Existing Issues - [x] I have searched the existing issues and discussions. ### Installation Method Pip Install ### Open WebUI Version 0.5.13-3-g09e2dd9 ### Ollama Version (if applicable) _No response_ ### Operating System 0.5.13 ### Browser (if applicable) edge ### 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. - [x] I have checked the browser console logs. - [x] I have checked the Docker container logs. - [x] I have listed steps to reproduce the bug in detail. ### Expected Behavior Upload successfully without exception ### Actual Behavior like this,The document contained only a few hundred words of text ![Image](https://github.com/user-attachments/assets/9bf7b404-4a6e-4c2a-915a-f42351879cb9) ### Steps to Reproduce workspace > knowledge > Create a knowledge base > upload files ### Logs & Screenshots ![Image](https://github.com/user-attachments/assets/df7c1678-3b56-49c5-aefa-fca73473c273) 2025-03-07 18:04:04.656 | WARNING | python_multipart.multipart:_internal_write:1401 - Skipping data after last boundary - {} 2025-03-07 18:04:04.659 | INFO | open_webui.routers.files:upload_file:42 - file.content_type: text/plain - {} 2025-03-07 18:04:04.695 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:782 - save_docs_to_vector_db: document data.txt file-420c35a0-aa5e-408b-98b3-747112ce1c0f - {} 2025-03-07 18:04:04.698 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:865 - adding to collection file-420c35a0-aa5e-408b-98b3-747112ce1c0f - {} 2025-03-07 18:04:04.698 | ERROR | open_webui.routers.retrieval:save_docs_to_vector_db:904 - 'NoneType' object has no attribute 'encode' - {} Traceback (most recent call last): File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1032, in _bootstrap self._bootstrap_inner() │ └ <function Thread._bootstrap_inner at 0x000001B05A1CC400> └ <WorkerThread(AnyIO worker thread, started 21044)> File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1075, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x000001B0412F1120> └ <WorkerThread(AnyIO worker thread, started 21044)> File "D:\app\ltw_zj\Python312\Lib\site-packages\anyio\_backends\_asyncio.py", line 962, in run result = context.run(func, *args) │ │ │ └ () │ │ └ functools.partial(<function upload_file at 0x000001B009AE1B20>, user=UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', nam... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x000001B04141B780> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\files.py", line 85, in upload_file process_file(request, ProcessFileForm(file_id=id), user=user) │ │ │ │ └ UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', name='oycw', email='ouyang7923@qq.com', role='admin', profile_image_url=... │ │ │ └ '420c35a0-aa5e-408b-98b3-747112ce1c0f' │ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'> │ └ <starlette.requests.Request object at 0x000001B042654A40> └ <function process_file at 0x000001B00C8A0680> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1040, in process_file result = save_docs_to_vector_db( └ <function save_docs_to_vector_db at 0x000001B00C817100> > File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 883, in save_docs_to_vector_db embeddings = embedding_function( └ <function get_embedding_function.<locals>.<lambda> at 0x000001B0426179C0> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\retrieval\utils.py", line 314, in <lambda> return lambda query, user=None: embedding_function.encode(query).tolist() │ │ └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校 、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ... │ └ None └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ... AttributeError: 'NoneType' object has no attribute 'encode' 2025-03-07 18:04:04.699 | ERROR | open_webui.routers.retrieval:process_file:1078 - 'NoneType' object has no attribute 'encode' - {} Traceback (most recent call last): File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1032, in _bootstrap self._bootstrap_inner() │ └ <function Thread._bootstrap_inner at 0x000001B05A1CC400> └ <WorkerThread(AnyIO worker thread, started 21044)> File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1075, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x000001B0412F1120> └ <WorkerThread(AnyIO worker thread, started 21044)> File "D:\app\ltw_zj\Python312\Lib\site-packages\anyio\_backends\_asyncio.py", line 962, in run result = context.run(func, *args) │ │ │ └ () │ │ └ functools.partial(<function upload_file at 0x000001B009AE1B20>, user=UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', nam... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x000001B04141B780> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\files.py", line 85, in upload_file process_file(request, ProcessFileForm(file_id=id), user=user) │ │ │ │ └ UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', name='oycw', email='ouyang7923@qq.com', role='admin', profile_image_url=... │ │ │ └ '420c35a0-aa5e-408b-98b3-747112ce1c0f' │ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'> │ └ <starlette.requests.Request object at 0x000001B042654A40> └ <function process_file at 0x000001B00C8A0680> > File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1068, in process_file raise e └ AttributeError("'NoneType' object has no attribute 'encode'") File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1040, in process_file result = save_docs_to_vector_db( └ <function save_docs_to_vector_db at 0x000001B00C817100> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 905, in save_docs_to_vector_db raise e File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 883, in save_docs_to_vector_db embeddings = embedding_function( └ <function get_embedding_function.<locals>.<lambda> at 0x000001B0426179C0> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\retrieval\utils.py", line 314, in <lambda> return lambda query, user=None: embedding_function.encode(query).tolist() │ │ └ ['小学四年级学生作息时间表 时间段\t���体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校 、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ... │ └ None └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ... AttributeError: 'NoneType' object has no attribute 'encode' 2025-03-07 18:04:04.701 | ERROR | open_webui.routers.files:upload_file:89 - 400: 'NoneType' object has no attribute 'encode' - {} Traceback (most recent call last): File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1068, in process_file raise e File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1040, in process_file result = save_docs_to_vector_db( └ <function save_docs_to_vector_db at 0x000001B00C817100> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 905, in save_docs_to_vector_db raise e File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 883, in save_docs_to_vector_db embeddings = embedding_function( └ <function get_embedding_function.<locals>.<lambda> at 0x000001B0426179C0> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\retrieval\utils.py", line 314, in <lambda> return lambda query, user=None: embedding_function.encode(query).tolist() │ │ └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校 、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ... │ └ None └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ... AttributeError: 'NoneType' object has no attribute 'encode' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1032, in _bootstrap self._bootstrap_inner() │ └ <function Thread._bootstrap_inner at 0x000001B05A1CC400> └ <WorkerThread(AnyIO worker thread, started 21044)> File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1075, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x000001B0412F1120> └ <WorkerThread(AnyIO worker thread, started 21044)> File "D:\app\ltw_zj\Python312\Lib\site-packages\anyio\_backends\_asyncio.py", line 962, in run result = context.run(func, *args) │ │ │ └ () │ │ └ functools.partial(<function upload_file at 0x000001B009AE1B20>, user=UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', nam... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x000001B04141B780> > File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\files.py", line 85, in upload_file process_file(request, ProcessFileForm(file_id=id), user=user) │ │ │ │ └ UserModel(id='18ec022e-e481-424e-a4bd-7ff227aab242', name='oycw', email='ouyang7923@qq.com', role='admin', profile_image_url=... │ │ │ └ '420c35a0-aa5e-408b-98b3-747112ce1c0f' │ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'> │ └ <starlette.requests.Request object at 0x000001B042654A40> └ <function process_file at 0x000001B00C8A0680> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1085, in process_file raise HTTPException( └ <class 'fastapi.exceptions.HTTPException'> fastapi.exceptions.HTTPException: 400: 'NoneType' object has no attribute 'encode' 2025-03-07 18:04:04.705 | ERROR | open_webui.routers.files:upload_file:90 - Error processing file: 420c35a0-aa5e-408b-98b3-747112ce1c0f - {} 2025-03-07 18:04:04.707 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:1855 - "POST /api/v1/files/ HTTP/1.1" 200 - {} 2025-03-07 18:04:04.736 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:782 - save_docs_to_vector_db: document data.txt b6f232cc-c6c9-4757-b0a3-ab857bd04ebe - {} 2025-03-07 18:04:04.738 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:865 - adding to collection b6f232cc-c6c9-4757-b0a3-ab857bd04ebe - {} 2025-03-07 18:04:04.738 | ERROR | open_webui.routers.retrieval:save_docs_to_vector_db:904 - 'NoneType' object has no attribute 'encode' - {} Traceback (most recent call last): File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1032, in _bootstrap self._bootstrap_inner() │ └ <function Thread._bootstrap_inner at 0x000001B05A1CC400> └ <WorkerThread(AnyIO worker thread, started 18476)> File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1075, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x000001B0412F1120> └ <WorkerThread(AnyIO worker thread, started 18476)> File "D:\app\ltw_zj\Python312\Lib\site-packages\anyio\_backends\_asyncio.py", line 962, in run result = context.run(func, *args) │ │ │ └ () │ │ └ functools.partial(<function add_file_to_knowledge_by_id at 0x000001B00DD814E0>, user=UserModel(id='18ec022e-e481-424e-a4bd-7f... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x000001B04135F680> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\knowledge.py", line 291, in add_file_to_knowledge_by_id process_file( └ <function process_file at 0x000001B00C8A0680> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1040, in process_file result = save_docs_to_vector_db( └ <function save_docs_to_vector_db at 0x000001B00C817100> > File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 883, in save_docs_to_vector_db embeddings = embedding_function( └ <function get_embedding_function.<locals>.<lambda> at 0x000001B00B994AE0> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\retrieval\utils.py", line 314, in <lambda> return lambda query, user=None: embedding_function.encode(query).tolist() │ │ └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校 、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ... │ └ None └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ... AttributeError: 'NoneType' object has no attribute 'encode' 2025-03-07 18:04:04.740 | ERROR | open_webui.routers.retrieval:process_file:1078 - 'NoneType' object has no attribute 'encode' - {} Traceback (most recent call last): File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1032, in _bootstrap self._bootstrap_inner() │ └ <function Thread._bootstrap_inner at 0x000001B05A1CC400> └ <WorkerThread(AnyIO worker thread, started 18476)> File "D:\app\ltw_zj\Python312\Lib\threading.py", line 1075, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x000001B0412F1120> └ <WorkerThread(AnyIO worker thread, started 18476)> File "D:\app\ltw_zj\Python312\Lib\site-packages\anyio\_backends\_asyncio.py", line 962, in run result = context.run(func, *args) │ │ │ └ () │ │ └ functools.partial(<function add_file_to_knowledge_by_id at 0x000001B00DD814E0>, user=UserModel(id='18ec022e-e481-424e-a4bd-7f... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x000001B04135F680> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\knowledge.py", line 291, in add_file_to_knowledge_by_id process_file( └ <function process_file at 0x000001B00C8A0680> > File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1068, in process_file raise e └ AttributeError("'NoneType' object has no attribute 'encode'") File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 1040, in process_file result = save_docs_to_vector_db( └ <function save_docs_to_vector_db at 0x000001B00C817100> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 905, in save_docs_to_vector_db raise e File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\routers\retrieval.py", line 883, in save_docs_to_vector_db embeddings = embedding_function( └ <function get_embedding_function.<locals>.<lambda> at 0x000001B00B994AE0> File "D:\app\ltw_zj\Python312\Lib\site-packages\open_webui\retrieval\utils.py", line 314, in <lambda> return lambda query, user=None: embedding_function.encode(query).tolist() │ │ └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校 、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ... │ └ None └ ['小学四年级学生作息时间表 时间段\t具体安排 6:30 - 7:00\t起床、洗漱、吃早餐 7:10 - 7:50\t准备上学(检查作业、书包等) 8:00 - 8:20\t到校、晨读或参加早操 8:20 - 9:00\t第一节课 9:10 - ... AttributeError: 'NoneType' object has no attribute 'encode' 2025-03-07 18:04:04.742 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 127.0.0.1:1855 - "POST /api/v1/knowledge/b6f232cc-c6c9-4757-b0a3-ab857bd04ebe/file/add HTTP/1.1" 400 - {} ### Additional Information _No response_
GiteaMirror added the bug label 2026-05-20 20:42:56 -05:00
Author
Owner

@rgaricano commented on GitHub (Mar 7, 2025):

update to latest version (0.5.20) & try again,
pip install -U open-webui

<!-- gh-comment-id:2706252749 --> @rgaricano commented on GitHub (Mar 7, 2025): update to latest version (0.5.20) & try again, `pip install -U open-webui`
Author
Owner

@ganhengquan commented on GitHub (Mar 12, 2025):

0.5.20 same problem

{detail: "400: 'NoneType' object has no attribute 'encode'"}
detail

"400: 'NoneType' object has no attribute 'encode'"

<!-- gh-comment-id:2716970712 --> @ganhengquan commented on GitHub (Mar 12, 2025): 0.5.20 same problem {detail: "400: 'NoneType' object has no attribute 'encode'"} detail : "400: 'NoneType' object has no attribute 'encode'"
Author
Owner

@pltchuong commented on GitHub (Mar 14, 2025):

@tjbck The issue is the default SentenseTransformer doesn't work somehow. I switched to OpenAI and use my API then it works. So probably just document issue?

<!-- gh-comment-id:2725411513 --> @pltchuong commented on GitHub (Mar 14, 2025): @tjbck The issue is the default `SentenseTransformer` doesn't work somehow. I switched to OpenAI and use my API then it works. So probably just document issue?
Author
Owner

@Classic298 commented on GitHub (Mar 14, 2025):

Wow yeah i am encountering the SAME ERROR

Guys please try to do the following

Go to admin panel
Go to documents
Try to download the sentence transformer with the small little download button and see if it works or an error happens

<!-- gh-comment-id:2725524568 --> @Classic298 commented on GitHub (Mar 14, 2025): Wow yeah i am encountering the SAME ERROR Guys please try to do the following Go to admin panel Go to documents Try to download the sentence transformer with the small little download button and see if it works or an error happens
Author
Owner

@tjbck commented on GitHub (Mar 14, 2025):

Make sure you're embedding model is both downloaded and set correctly, if you check for previous discussions you'll see that this issue is caused by embedding model misconfiguration.

<!-- gh-comment-id:2725573434 --> @tjbck commented on GitHub (Mar 14, 2025): Make sure you're embedding model is both downloaded and set correctly, if you check for previous discussions you'll see that this issue is caused by embedding model misconfiguration.
Author
Owner

@Classic298 commented on GitHub (Mar 15, 2025):

That's the thing, when trying to download the embedding model through

Admin panel > documents > sentence transformer

And try to click the download button even for the default sentence transformer i am immediately thrown the error of 'NoneType' object has no attribute 'split'

I tried to completely reinstall OpenWebUI via pip, used different installation methods. I made sure all dependencies are on the same version that OpenWebUI depends them to be on, and i also tried updating sentence transformers package individually to a newer version but i always received the same error.

File "/opt/openwebui/venv/lib/python3.11/site-packages/open_webui/utils/middleware.py", line 341, in chat_web_search_handler
    results = await process_web_search(
                   └ <function process_web_search at 0x7f8db28d0d60>
  File "/opt/openwebui/venv/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 1481, in process_web_search
    raise HTTPException(
          └ <class 'fastapi.exceptions.HTTPException'>
fastapi.exceptions.HTTPException: 400: [ERROR: 'NoneType' object has no attribute 'encode']

              │    │           └ <module 'transformers.integrations' from '/opt/openwebui/venv/lib/python3.11/site-packages/transformers/integrations/init...
              │    └ <function _LazyModule._get_module at 0x7fa33bd616c0>
              └ <module 'transformers.integrations' from '/opt/openwebui/venv/lib/python3.11/site-packages/transformers/integrations/init...
   File "/opt/openwebui/venv/lib/python3.11/site-packages/transformers/utils/import_utils.py", line 1865, in _get_module
     raise RuntimeError(
 RuntimeError: Failed to import transformers.integrations.integration_utils because of the following error (look up to see its traceback):
 Failed to import transformers.modeling_utils because of the following error (look up to see its traceback):
 'NoneType' object has no attribute 'split'
 2025-03-14 14:55:16.912 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - - "POST /api/v1/retrieval/embedding/update
'NoneType' object has no attribute 'split'

-> the upper stacktrace is when using the websearch
-> the lower stack trace is when trying to download any sentence transformer from the admin panel such as sentence-transformers/all-MiniLM-L6-v2 or all-MiniLM-L12-v2

I am not quite sure what you mean by embedding model misconfiguration or that the model is set incorrectly @tjbck

<!-- gh-comment-id:2726362930 --> @Classic298 commented on GitHub (Mar 15, 2025): That's the thing, when trying to download the embedding model through Admin panel > documents > sentence transformer And try to click the download button even for the default sentence transformer i am immediately thrown the error of 'NoneType' object has no attribute 'split' I tried to completely reinstall OpenWebUI via pip, used different installation methods. I made sure all dependencies are on the same version that OpenWebUI depends them to be on, and i also tried updating sentence transformers package individually to a newer version but i always received the same error. ``` File "/opt/openwebui/venv/lib/python3.11/site-packages/open_webui/utils/middleware.py", line 341, in chat_web_search_handler results = await process_web_search( └ <function process_web_search at 0x7f8db28d0d60> File "/opt/openwebui/venv/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 1481, in process_web_search raise HTTPException( └ <class 'fastapi.exceptions.HTTPException'> fastapi.exceptions.HTTPException: 400: [ERROR: 'NoneType' object has no attribute 'encode'] │ │ └ <module 'transformers.integrations' from '/opt/openwebui/venv/lib/python3.11/site-packages/transformers/integrations/init... │ └ <function _LazyModule._get_module at 0x7fa33bd616c0> └ <module 'transformers.integrations' from '/opt/openwebui/venv/lib/python3.11/site-packages/transformers/integrations/init... File "/opt/openwebui/venv/lib/python3.11/site-packages/transformers/utils/import_utils.py", line 1865, in _get_module raise RuntimeError( RuntimeError: Failed to import transformers.integrations.integration_utils because of the following error (look up to see its traceback): Failed to import transformers.modeling_utils because of the following error (look up to see its traceback): 'NoneType' object has no attribute 'split' 2025-03-14 14:55:16.912 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - - "POST /api/v1/retrieval/embedding/update 'NoneType' object has no attribute 'split' ``` -> the upper stacktrace is when using the websearch -> the lower stack trace is when trying to download any sentence transformer from the admin panel such as `sentence-transformers/all-MiniLM-L6-v2` or all-MiniLM-L12-v2 I am not quite sure what you mean by embedding model misconfiguration or that the model is set incorrectly @tjbck
Author
Owner

@Sycondrin13 commented on GitHub (Mar 16, 2025):

I'm using the docker container image ghcr.io/open-webui/open-webui:cuda and receiving the same error with nomic-embed-text (Which I had already pulled via ollama)

<!-- gh-comment-id:2727117374 --> @Sycondrin13 commented on GitHub (Mar 16, 2025): I'm using the docker container image `ghcr.io/open-webui/open-webui:cuda` and receiving the same error with nomic-embed-text (Which I had already pulled via ollama)
Author
Owner

@ganhengquan commented on GitHub (Mar 17, 2025):

Click on the document inside the download, the prompt success, but the actual can not. This is a problem. When I manually complete the model file, it can be retrieved normally.

<!-- gh-comment-id:2728547259 --> @ganhengquan commented on GitHub (Mar 17, 2025): Click on the document inside the download, the prompt success, but the actual can not. This is a problem. When I manually complete the model file, it can be retrieved normally.
Author
Owner

@Classic298 commented on GitHub (Mar 17, 2025):

Not sure if this is helpful to you, but for me the error was that I ran OpenWebUI with -OO python optimizations. Removing this, it started working again

<!-- gh-comment-id:2728766569 --> @Classic298 commented on GitHub (Mar 17, 2025): Not sure if this is helpful to you, but for me the error was that I ran OpenWebUI with -OO python optimizations. Removing this, it started working again
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#119508