[GH-ISSUE #9909] Failed to upload and add text content to the knowledge base #15695

Closed
opened 2026-04-19 21:50:57 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @oldmale on GitHub (Feb 13, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/9909

I used file upload when creating the knowledge base, and the file name is api.txt
#Company Technical Documents

1. system architecture

Our system adopts a microservice architecture, where each service module runs independently and interacts with each other through APIs.

2. Database Design

The database uses MySQL to store all user data, and the table structure is as follows:
-User Table: id, name, email
-Product List: id, name, price

3. API Design

All APIs adopt RESTful style, and the following are common interfaces:
-GET/users: Get all users
-POST/products: Add new products
return:
"hash": null,
"filename": "api.txt",
"data": {},
"meta": {
"name": "api.txt",
"content_type": "text/plain",
"size": 470,
"data": {}
},
"created_at": 1739456988,
"updated_at": 1739456988,
"path": "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/data/uploads/a0f742be-7547-45e5-8ec8-7336007e9cc6_api.txt",
"access_control": null,
"error": "'NoneType' object has no attribute 'encode'"
}

ERROR [open_webui.routers.retrieval] 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):
File "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/routers/retrieval.py", line 974, in process_file
raise e
File "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/routers/retrieval.py", line 946, in process_file
result = save_docs_to_vector_db(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/routers/retrieval.py", line 819, in save_docs_to_vector_db
raise e
File "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/routers/retrieval.py", line 797, in save_docs_to_vector_db
embeddings = embedding_function(
^^^^^^^^^^^^^^^^^^^
File "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/retrieval/utils.py", line 265, in
return lambda query, user=None: embedding_function.encode(query).tolist()
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'
I don't know how to solve this problem, can you help me take a look.Thank you!

Originally created by @oldmale on GitHub (Feb 13, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/9909 I used file upload when creating the knowledge base, and the file name is api.txt #Company Technical Documents ## 1. system architecture Our system adopts a microservice architecture, where each service module runs independently and interacts with each other through APIs. ## 2. Database Design The database uses MySQL to store all user data, and the table structure is as follows: -User Table: id, name, email -Product List: id, name, price ## 3. API Design All APIs adopt RESTful style, and the following are common interfaces: -GET/users: Get all users -POST/products: Add new products return: "hash": null, "filename": "api.txt", "data": {}, "meta": { "name": "api.txt", "content_type": "text/plain", "size": 470, "data": {} }, "created_at": 1739456988, "updated_at": 1739456988, "path": "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/data/uploads/a0f742be-7547-45e5-8ec8-7336007e9cc6_api.txt", "access_control": null, "error": "'NoneType' object has no attribute 'encode'" } ERROR [open_webui.routers.retrieval] 'NoneType' object has no attribute 'encode' Traceback (most recent call last): File "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/routers/retrieval.py", line 974, in process_file raise e File "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/routers/retrieval.py", line 946, in process_file result = save_docs_to_vector_db( ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/routers/retrieval.py", line 819, in save_docs_to_vector_db raise e File "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/routers/retrieval.py", line 797, in save_docs_to_vector_db embeddings = embedding_function( ^^^^^^^^^^^^^^^^^^^ File "/home/hxm/anaconda3/envs/ollama/lib/python3.12/site-packages/open_webui/retrieval/utils.py", line 265, in <lambda> return lambda query, user=None: embedding_function.encode(query).tolist() ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'encode' I don't know how to solve this problem, can you help me take a look.Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#15695