mirror of
https://github.com/open-webui/open-webui.git
synced 2026-06-03 15:27:37 -05:00
[GH-ISSUE #8797] RAG: AttributeError: 'NoneType' object has no attribute 'encode' #69867
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mengdeer589 on GitHub (Jan 23, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8797
Bug Report
Important Notes
Installation Method
uv pip install open-webui
Environment
**Open WebUI Version:0.5.6
**Ollama (if applicable):0.5.7
Operating System: windows 11
**Browser (if applicable):edge 132.0.2957.115 (正式版本) (64 位)
Description
创建新知识库,上传文件遇到AttributeError: 'NoneType' object has no attribute 'encode'错误
Reproduction Details
Steps to Reproduce:
[Outline the steps to reproduce the bug. Be as detailed as possible.]
Logs and Screenshots
下面是控制台输出,应该是给出的文件路径不正确导致找不到文件,从而返回None
(web_ui) PS E:\project\web_ui> open-webui serve
Loading WEBUI_SECRET_KEY from file, not provided as an environment variable.
Loading WEBUI_SECRET_KEY from E:\project\web_ui.webui_secret_key
E:\project\web_ui.venv\Lib\site-packages\open_webui
E:\project\web_ui.venv\Lib\site-packages
E:\project\web_ui.venv\Lib
Running migrations
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [open_webui.env] 'ENABLE_API_KEY' loaded from the latest database entry
INFO [open_webui.env] 'ENABLE_API_KEY_ENDPOINT_RESTRICTIONS' loaded from the latest database entry
INFO [open_webui.env] 'API_KEY_ALLOWED_ENDPOINTS' loaded from the latest database entry
INFO [open_webui.env] 'JWT_EXPIRES_IN' loaded from the latest database entry
INFO [open_webui.env] 'ENABLE_OLLAMA_API' loaded from the latest database entry
INFO [open_webui.env] 'OLLAMA_BASE_URLS' loaded from the latest database entry
INFO [open_webui.env] 'OLLAMA_API_CONFIGS' loaded from the latest database entry
INFO [open_webui.env] 'ENABLE_OPENAI_API' loaded from the latest database entry
INFO [open_webui.env] 'OPENAI_API_KEYS' loaded from the latest database entry
INFO [open_webui.env] 'OPENAI_API_BASE_URLS' loaded from the latest database entry
INFO [open_webui.env] 'OPENAI_API_CONFIGS' loaded from the latest database entry
INFO [open_webui.env] 'WEBUI_URL' loaded from the latest database entry
INFO [open_webui.env] 'ENABLE_SIGNUP' loaded from the latest database entry
INFO [open_webui.env] 'DEFAULT_LOCALE' loaded from the latest database entry
INFO [open_webui.env] 'DEFAULT_MODELS' loaded from the latest database entry
INFO [open_webui.env] 'DEFAULT_PROMPT_SUGGESTIONS' loaded from the latest database entry
INFO [open_webui.env] 'MODEL_ORDER_LIST' loaded from the latest database entry
INFO [open_webui.env] 'DEFAULT_USER_ROLE' loaded from the latest database entry
INFO [open_webui.env] 'ENABLE_CHANNELS' loaded from the latest database entry
INFO [open_webui.env] 'WEBHOOK_URL' loaded from the latest database entry
INFO [open_webui.env] 'ENABLE_COMMUNITY_SHARING' loaded from the latest database entry
INFO [open_webui.env] 'ENABLE_MESSAGE_RATING' loaded from the latest database entry
WARNI [open_webui.env]
WARNING: CORS_ALLOW_ORIGIN IS SET TO '*' - NOT RECOMMENDED FOR PRODUCTION DEPLOYMENTS.
INFO [open_webui.env] 'SHOW_ADMIN_DETAILS' loaded from the latest database entry
INFO [open_webui.env] Embedding model set: sentence-transformers/all-MiniLM-L6-v2
INFO [open_webui.env] 'IMAGE_GENERATION_ENGINE' loaded from the latest database entry
INFO [open_webui.env] 'ENABLE_IMAGE_GENERATION' loaded from the latest database entry
INFO [open_webui.env] 'AUTOMATIC1111_BASE_URL' loaded from the latest database entry
INFO [open_webui.env] 'AUTOMATIC1111_API_AUTH' loaded from the latest database entry
INFO [open_webui.env] 'COMFYUI_BASE_URL' loaded from the latest database entry
INFO [open_webui.env] 'COMFYUI_WORKFLOW' loaded from the latest database entry
INFO [open_webui.env] 'COMFYUI_WORKFLOW' loaded from the latest database entry
INFO [open_webui.env] 'IMAGES_OPENAI_API_BASE_URL' loaded from the latest database entry
INFO [open_webui.env] 'IMAGES_OPENAI_API_KEY' loaded from the latest database entry
WARNI [langchain_community.utils.user_agent] USER_AGENT environment variable not set, consider setting it to identify your requests.
/ _ \ _ __ ___ _ __ \ \ / /| | | | | |_ |
| | | | ' \ / _ \ '_ \ \ \ /\ / / _ \ '_ | | | || |
| || | |) | / | | | \ V V / / |) | || || |
_/| ./ _|| || _/_/ _|./ _/|_|
||
v0.5.6 - building the best open-source AI user interface.
https://github.com/open-webui/open-webui
ERROR [open_webui.retrieval.utils] Cannot determine model snapshot path: Cannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass 'local_files_only=False' as input.
Traceback (most recent call last):
File "E:\project\web_ui.venv\Lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "E:\project\web_ui.venv\Lib\site-packages\huggingface_hub_snapshot_download.py", line 219, in snapshot_download
raise LocalEntryNotFoundError(
huggingface_hub.errors.LocalEntryNotFoundError: Cannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass 'local_files_only=False' as input.
WARNI [sentence_transformers.SentenceTransformer] No sentence-transformers model found with name sentence-transformers/all-MiniLM-L6-v2. Creating a new one with mean pooling.
INFO: Started server process [7748]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
INFO: 127.0.0.1:52278 - "GET /static/splash.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:52278 - "GET /api/config HTTP/1.1" 200 OK
INFO: ('127.0.0.1', 52282) - "WebSocket /ws/socket.io/?EIO=4&transport=websocket" [accepted]
INFO: connection open
INFO: 127.0.0.1:52278 - "GET /static/favicon.png HTTP/1.1" 200 OK
INFO: 127.0.0.1:52279 - "GET /api/v1/auths/ HTTP/1.1" 200 OK
INFO: 127.0.0.1:52279 - "GET /api/config HTTP/1.1" 200 OK
INFO: 127.0.0.1:52279 - "GET /api/changelog HTTP/1.1" 200 OK
INFO: 127.0.0.1:52279 - "GET /api/v1/users/user/settings HTTP/1.1" 200 OK
INFO [open_webui.routers.ollama] get_all_models()
INFO: 127.0.0.1:52279 - "GET /api/models HTTP/1.1" 200 OK
INFO: 127.0.0.1:52279 - "GET /api/v1/configs/banners HTTP/1.1" 200 OK
INFO: 127.0.0.1:52279 - "GET /api/v1/tools/ HTTP/1.1" 200 OK
INFO: 127.0.0.1:52279 - "GET /api/version/updates HTTP/1.1" 200 OK
INFO: 127.0.0.1:52279 - "GET /api/v1/channels/ HTTP/1.1" 200 OK
INFO: 127.0.0.1:52278 - "GET /ollama/api/version HTTP/1.1" 200 OK
INFO: 127.0.0.1:52278 - "GET /api/v1/users/user/settings HTTP/1.1" 200 OK
INFO: 127.0.0.1:52278 - "GET /api/v1/chats/all/tags HTTP/1.1" 200 OK
INFO: 127.0.0.1:52278 - "GET /api/v1/chats/pinned HTTP/1.1" 200 OK
INFO: 127.0.0.1:52279 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK
INFO: 127.0.0.1:52278 - "GET /api/v1/folders/ HTTP/1.1" 200 OK
INFO: 127.0.0.1:52278 - "GET /api/v1/chats/?page=2 HTTP/1.1" 200 OK
INFO: 127.0.0.1:52278 - "GET /api/v1/models/ HTTP/1.1" 200 OK
INFO [open_webui.routers.ollama] get_all_models()
INFO: 127.0.0.1:52279 - "GET /api/models HTTP/1.1" 200 OK
INFO: 127.0.0.1:52279 - "GET /api/v1/knowledge/ HTTP/1.1" 200 OK
INFO: 127.0.0.1:52278 - "GET /static/favicon.png HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:52279 - "GET /api/v1/knowledge/list HTTP/1.1" 200 OK
INFO: 127.0.0.1:52279 - "GET /api/v1/knowledge/6869e999-c8b3-4a19-8c4c-8f958e46a93c HTTP/1.1" 200 OK
WARNI [python_multipart.multipart] Skipping data after last boundary
INFO [open_webui.routers.files] file.content_type: text/plain
INFO [open_webui.routers.retrieval] save_docs_to_vector_db: document 更新日志.txt file-276f08fd-3899-4868-9e53-20f2e71181c5
Collection file-276f08fd-3899-4868-9e53-20f2e71181c5 does not exist.
INFO [open_webui.routers.retrieval] adding to collection file-276f08fd-3899-4868-9e53-20f2e71181c5
ERROR [open_webui.routers.retrieval] 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):
File "E:\project\web_ui.venv\Lib\site-packages\open_webui\routers\retrieval.py", line 777, in save_docs_to_vector_db
embeddings = embedding_function(
^^^^^^^^^^^^^^^^^^^
File "E:\project\web_ui.venv\Lib\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 "E:\project\web_ui.venv\Lib\site-packages\open_webui\routers\retrieval.py", line 953, in process_file
raise e
File "E:\project\web_ui.venv\Lib\site-packages\open_webui\routers\retrieval.py", line 926, in process_file
result = save_docs_to_vector_db(
^^^^^^^^^^^^^^^^^^^^^^^
File "E:\project\web_ui.venv\Lib\site-packages\open_webui\routers\retrieval.py", line 799, in save_docs_to_vector_db
raise e
File "E:\project\web_ui.venv\Lib\site-packages\open_webui\routers\retrieval.py", line 777, in save_docs_to_vector_db
embeddings = embedding_function(
^^^^^^^^^^^^^^^^^^^
File "E:\project\web_ui.venv\Lib\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 "E:\project\web_ui.venv\Lib\site-packages\open_webui\routers\retrieval.py", line 953, in process_file
raise e
File "E:\project\web_ui.venv\Lib\site-packages\open_webui\routers\retrieval.py", line 926, in process_file
result = save_docs_to_vector_db(
^^^^^^^^^^^^^^^^^^^^^^^
File "E:\project\web_ui.venv\Lib\site-packages\open_webui\routers\retrieval.py", line 799, in save_docs_to_vector_db
raise e
File "E:\project\web_ui.venv\Lib\site-packages\open_webui\routers\retrieval.py", line 777, in save_docs_to_vector_db
embeddings = embedding_function(
^^^^^^^^^^^^^^^^^^^
File "E:\project\web_ui.venv\Lib\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:
Object