Failed to add file to knowledge base #3568

Closed
opened 2025-11-11 15:34:04 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @beargolden on GitHub (Feb 4, 2025).

Installation Method

conda create -n open-webui python=3.11
conda activate open-webui
pip install open-webui
open-webui serve

Environment

  • Open WebUI Version: v0.5.7

  • Ollama (if applicable): v0.5.7

  • Operating System: Ubuntu 24.04.1 LTS

  • Browser (if applicable): Chromium 131.0.6778.264

Confirmation:

  • [Y] I have read and followed all the instructions provided in the README.md.
  • [Y] I am on the latest version of both Open WebUI and Ollama.
  • [Y] I have included the browser console logs.
  • [Y] I have included the Docker container logs.
  • [Y] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

Add files to newly-created knowledge base using the administrator user

Actual Behavior:

Failed to add file to knowledge base

Description

Bug Summary:
WARNI [python_multipart.multipart] Skipping data after last boundary
INFO [open_webui.routers.files] file.content_type: application/pdf
INFO [open_webui.routers.retrieval] save_docs_to_vector_db: document 信号系统-0.pdf file-7ccbe31c-ea30-4a4b-a3fc-6990b6839dde
Collection file-7ccbe31c-ea30-4a4b-a3fc-6990b6839dde does not exist.
INFO [open_webui.routers.retrieval] adding to collection file-7ccbe31c-ea30-4a4b-a3fc-6990b6839dde
ERROR [open_webui.routers.retrieval] 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 777, in save_docs_to_vector_db
embeddings = embedding_function(
^^^^^^^^^^^^^^^^^^^
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/retrieval/utils.py", line 262, in
return lambda query: embedding_function.encode(query).tolist()
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'
ERROR [open_webui.routers.retrieval] 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 953, in process_file
raise e
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 926, in process_file
result = save_docs_to_vector_db(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 799, in save_docs_to_vector_db
raise e
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 777, in save_docs_to_vector_db
embeddings = embedding_function(
^^^^^^^^^^^^^^^^^^^
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/retrieval/utils.py", line 262, in
return lambda query: embedding_function.encode(query).tolist()
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'
ERROR [open_webui.routers.files] 400: 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 953, in process_file
raise e
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 926, in process_file
result = save_docs_to_vector_db(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 799, in save_docs_to_vector_db
raise e
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 777, in save_docs_to_vector_db
embeddings = embedding_function(
^^^^^^^^^^^^^^^^^^^
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/retrieval/utils.py", line 262, in
return lambda query: embedding_function.encode(query).tolist()
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/files.py", line 74, in upload_file
process_file(request, ProcessFileForm(file_id=id))
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 962, in process_file
raise HTTPException(
fastapi.exceptions.HTTPException: 400: 'NoneType' object has no attribute 'encode'
ERROR [open_webui.routers.files] Error processing file: 7ccbe31c-ea30-4a4b-a3fc-6990b6839dde
INFO: 127.0.0.1:56684 - "POST /api/v1/files/ HTTP/1.1" 200 OK
Collection file-7ccbe31c-ea30-4a4b-a3fc-6990b6839dde does not exist.
INFO [open_webui.routers.retrieval] save_docs_to_vector_db: document 信号系统-0.pdf af9f8aed-2dd3-4ef3-8964-d43a45a60c92
Collection af9f8aed-2dd3-4ef3-8964-d43a45a60c92 does not exist.
INFO [open_webui.routers.retrieval] adding to collection af9f8aed-2dd3-4ef3-8964-d43a45a60c92
ERROR [open_webui.routers.retrieval] 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 777, in save_docs_to_vector_db
embeddings = embedding_function(
^^^^^^^^^^^^^^^^^^^
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/retrieval/utils.py", line 262, in
return lambda query: embedding_function.encode(query).tolist()
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'
ERROR [open_webui.routers.retrieval] 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 953, in process_file
raise e
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 926, in process_file
result = save_docs_to_vector_db(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 799, in save_docs_to_vector_db
raise e
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 777, in save_docs_to_vector_db
embeddings = embedding_function(
^^^^^^^^^^^^^^^^^^^
File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/retrieval/utils.py", line 262, in
return lambda query: embedding_function.encode(query).tolist()
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'
INFO: 127.0.0.1:56684 - "POST /api/v1/knowledge/af9f8aed-2dd3-4ef3-8964-d43a45a60c92/file/add HTTP/1.1" 400 Bad Request

Thank you for your consideration~

Originally created by @beargolden on GitHub (Feb 4, 2025). ## Installation Method conda create -n open-webui python=3.11 conda activate open-webui pip install open-webui open-webui serve ## Environment - **Open WebUI Version:** v0.5.7 - **Ollama (if applicable):** v0.5.7 - **Operating System:** Ubuntu 24.04.1 LTS - **Browser (if applicable):** Chromium 131.0.6778.264 **Confirmation:** - [Y] I have read and followed all the instructions provided in the README.md. - [Y] I am on the latest version of both Open WebUI and Ollama. - [Y] I have included the browser console logs. - [Y] I have included the Docker container logs. - [Y] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: Add files to newly-created knowledge base using the administrator user ## Actual Behavior: Failed to add file to knowledge base ## Description **Bug Summary:** WARNI [python_multipart.multipart] Skipping data after last boundary INFO [open_webui.routers.files] file.content_type: application/pdf INFO [open_webui.routers.retrieval] save_docs_to_vector_db: document 信号系统-0.pdf file-7ccbe31c-ea30-4a4b-a3fc-6990b6839dde Collection file-7ccbe31c-ea30-4a4b-a3fc-6990b6839dde does not exist. INFO [open_webui.routers.retrieval] adding to collection file-7ccbe31c-ea30-4a4b-a3fc-6990b6839dde ERROR [open_webui.routers.retrieval] 'NoneType' object has no attribute 'encode' Traceback (most recent call last): File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 777, in save_docs_to_vector_db embeddings = embedding_function( ^^^^^^^^^^^^^^^^^^^ File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/retrieval/utils.py", line 262, in <lambda> return lambda query: embedding_function.encode(query).tolist() ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'encode' ERROR [open_webui.routers.retrieval] 'NoneType' object has no attribute 'encode' Traceback (most recent call last): File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 953, in process_file raise e File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 926, in process_file result = save_docs_to_vector_db( ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 799, in save_docs_to_vector_db raise e File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 777, in save_docs_to_vector_db embeddings = embedding_function( ^^^^^^^^^^^^^^^^^^^ File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/retrieval/utils.py", line 262, in <lambda> return lambda query: embedding_function.encode(query).tolist() ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'encode' ERROR [open_webui.routers.files] 400: 'NoneType' object has no attribute 'encode' Traceback (most recent call last): File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 953, in process_file raise e File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 926, in process_file result = save_docs_to_vector_db( ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 799, in save_docs_to_vector_db raise e File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 777, in save_docs_to_vector_db embeddings = embedding_function( ^^^^^^^^^^^^^^^^^^^ File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/retrieval/utils.py", line 262, in <lambda> return lambda query: embedding_function.encode(query).tolist() ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'encode' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/files.py", line 74, in upload_file process_file(request, ProcessFileForm(file_id=id)) File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 962, in process_file raise HTTPException( fastapi.exceptions.HTTPException: 400: 'NoneType' object has no attribute 'encode' ERROR [open_webui.routers.files] Error processing file: 7ccbe31c-ea30-4a4b-a3fc-6990b6839dde INFO: 127.0.0.1:56684 - "POST /api/v1/files/ HTTP/1.1" 200 OK Collection file-7ccbe31c-ea30-4a4b-a3fc-6990b6839dde does not exist. INFO [open_webui.routers.retrieval] save_docs_to_vector_db: document 信号系统-0.pdf af9f8aed-2dd3-4ef3-8964-d43a45a60c92 Collection af9f8aed-2dd3-4ef3-8964-d43a45a60c92 does not exist. INFO [open_webui.routers.retrieval] adding to collection af9f8aed-2dd3-4ef3-8964-d43a45a60c92 ERROR [open_webui.routers.retrieval] 'NoneType' object has no attribute 'encode' Traceback (most recent call last): File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 777, in save_docs_to_vector_db embeddings = embedding_function( ^^^^^^^^^^^^^^^^^^^ File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/retrieval/utils.py", line 262, in <lambda> return lambda query: embedding_function.encode(query).tolist() ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'encode' ERROR [open_webui.routers.retrieval] 'NoneType' object has no attribute 'encode' Traceback (most recent call last): File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 953, in process_file raise e File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 926, in process_file result = save_docs_to_vector_db( ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 799, in save_docs_to_vector_db raise e File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/routers/retrieval.py", line 777, in save_docs_to_vector_db embeddings = embedding_function( ^^^^^^^^^^^^^^^^^^^ File "/home/xw/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/retrieval/utils.py", line 262, in <lambda> return lambda query: embedding_function.encode(query).tolist() ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'encode' INFO: 127.0.0.1:56684 - "POST /api/v1/knowledge/af9f8aed-2dd3-4ef3-8964-d43a45a60c92/file/add HTTP/1.1" 400 Bad Request Thank you for your consideration~
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#3568