[GH-ISSUE #20732] issue: NoneType has no attribute 'encode' #34806

Closed
opened 2026-04-25 08:59:09 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @kmeliksetian on GitHub (Jan 16, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/20732

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

0.7.2

Ollama Version (if applicable)

No response

Operating System

Debian 13

Browser (if applicable)

No response

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 included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

Uploading a document to Knowledge / Documents with the default local embedding model sentence-transformers/all-MiniLM-L6-v2 should:

successfully ingest the file

generate embeddings

complete the upload without errors

make the document searchable/usable for RAG

Actual Behavior

When uploading a document, OpenWebUI fails with an exception:

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

Upload/ingest aborts and the document is not added.

This looks like the local embedding model is not initialized (encoder is None) during document processing.

Steps to Reproduce

Deploy OpenWebUI (Docker) and open the UI.

Go to Admin Settings → Documents.

Set Embedding model to: sentence-transformers/all-MiniLM-L6-v2

Save the settings.

Go to Documents / Knowledge and try to upload any file (e.g. a PDF or TXT).

Observe the error: 'NoneType' object has no attribute 'encode'

Logs & Screenshots

                 └ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/__init__.py'>

  File "/usr/local/lib/python3.11/asyncio/threads.py", line 25, in to_thread

    return await loop.run_in_executor(None, func_call)

                 │    │                     └ functools.partial(<built-in method run of _contextvars.Context object at 0x7f005ae043c0>, <function get_embedding_function.<l...

                 │    └ <function BaseEventLoop.run_in_executor at 0x7f0126a77420>

                 └ <_UnixSelectorEventLoop running=False closed=True debug=False>

  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run

    result = self.fn(*self.args, **self.kwargs)

             │        │            └ None

             │        └ None

             └ None

  File "/app/backend/open_webui/retrieval/utils.py", line 804, in <lambda>

    lambda query, prefix=None: embedding_function.encode(

           │                   └ None

           └ ['Bundesgesetzblatt Teil I 2024 Ausgegeben zu Bonn am 27. November 2024 Nr. 363 Erste Verordnung zur Änderung der Ukraine-Auf...

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

2026-01-16 15:03:15.285 | ERROR    | open_webui.routers.retrieval:process_file:1792 - 'NoneType' object has no attribute 'encode'

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 0x7f0127578ae0>

    └ <WorkerThread(AnyIO worker thread, started 139639033681600)>

  File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner

    self.run()

    │    └ <function WorkerThread.run at 0x7f00812e1e40>

    └ <WorkerThread(AnyIO worker thread, started 139639033681600)>

  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 986, in run

    result = context.run(func, *args)

             │       │   │      └ ()

             │       │   └ functools.partial(<function process_uploaded_file at 0x7f0083d21080>, <starlette.requests.Request object at 0x7f0070114410>, ...

             │       └ <method 'run' of '_contextvars.Context' objects>

             └ <_contextvars.Context object at 0x7f008195dfc0>

  File "/app/backend/open_webui/routers/files.py", line 189, in process_uploaded_file

    _process_handler(db_session)

    │                └ <sqlalchemy.orm.session.Session object at 0x7f005ad13750>

    └ <function process_uploaded_file.<locals>._process_handler at 0x7f005aa66e80>

  File "/app/backend/open_webui/routers/files.py", line 153, in _process_handler

    process_file(

    └ <function process_file at 0x7f0083d20720>

> File "/app/backend/open_webui/routers/retrieval.py", line 1789, in process_file

    raise e

          └ AttributeError("'NoneType' object has no attribute 'encode'")

  File "/app/backend/open_webui/routers/retrieval.py", line 1750, in process_file

    result = save_docs_to_vector_db(

             └ <function save_docs_to_vector_db at 0x7f0083d20540>

  File "/app/backend/open_webui/routers/retrieval.py", line 1571, in save_docs_to_vector_db

    raise e

  File "/app/backend/open_webui/routers/retrieval.py", line 1542, in save_docs_to_vector_db

    embeddings = asyncio.run(

                 │       └ <function run at 0x7f0126c293a0>

                 └ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/__init__.py'>

  File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run

    return runner.run(main)

           │      │   └ <coroutine object get_embedding_function.<locals>.async_embedding_function at 0x7f005abd1740>

           │      └ <function Runner.run at 0x7f0126a78f40>

           └ <asyncio.runners.Runner object at 0x7f0070f69210>

  File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run

    return self._loop.run_until_complete(task)

           │    │                        └ <Task finished name='Task-63059' coro=<get_embedding_function.<locals>.async_embedding_function() done, defined at /app/backe...

           │    └ None

           └ <asyncio.runners.Runner object at 0x7f0070f69210>

  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete

    return future.result()

           │      └ <method 'result' of '_asyncio.Task' objects>

           └ <Task finished name='Task-63059' coro=<get_embedding_function.<locals>.async_embedding_function() done, defined at /app/backe...

  File "/app/backend/open_webui/retrieval/utils.py", line 802, in async_embedding_function

    return await asyncio.to_thread(

                 │       └ <function to_thread at 0x7f0126a911c0>

                 └ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/__init__.py'>

  File "/usr/local/lib/python3.11/asyncio/threads.py", line 25, in to_thread

    return await loop.run_in_executor(None, func_call)

                 │    │                     └ functools.partial(<built-in method run of _contextvars.Context object at 0x7f005ae043c0>, <function get_embedding_function.<l...

                 │    └ <function BaseEventLoop.run_in_executor at 0x7f0126a77420>

                 └ <_UnixSelectorEventLoop running=False closed=True debug=False>

  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run

    result = self.fn(*self.args, **self.kwargs)

             │        │            └ None

             │        └ None

             └ None

  File "/app/backend/open_webui/retrieval/utils.py", line 804, in <lambda>

    lambda query, prefix=None: embedding_function.encode(

           │                   └ None

           └ ['Bundesgesetzblatt Teil I 2024 Ausgegeben zu Bonn am 27. November 2024 Nr. 363 Erste Verordnung zur Änderung der Ukraine-Auf...

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

Additional Information

What I already tried

Based on similar issues and troubleshooting suggestions, I already tried the following without success:

Re-saving the embedding model in Admin Settings → Documents

Forcing a re-download of the model

Switching the embedding provider from local (sentence-transformers) to other providers such as Ollama and OpenAI (which worked)

Switching back from Ollama/OpenAI to the local embedding model
→ the issue persists only with the local default embedding model

Originally created by @kmeliksetian on GitHub (Jan 16, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/20732 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version 0.7.2 ### Ollama Version (if applicable) _No response_ ### Operating System Debian 13 ### Browser (if applicable) _No response_ ### 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 included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior Uploading a document to Knowledge / Documents with the default local embedding model sentence-transformers/all-MiniLM-L6-v2 should: successfully ingest the file generate embeddings complete the upload without errors make the document searchable/usable for RAG ### Actual Behavior When uploading a document, OpenWebUI fails with an exception: Error: 'NoneType' object has no attribute 'encode' Upload/ingest aborts and the document is not added. This looks like the local embedding model is not initialized (encoder is None) during document processing. ### Steps to Reproduce Deploy OpenWebUI (Docker) and open the UI. Go to Admin Settings → Documents. Set Embedding model to: sentence-transformers/all-MiniLM-L6-v2 Save the settings. Go to Documents / Knowledge and try to upload any file (e.g. a PDF or TXT). Observe the error: 'NoneType' object has no attribute 'encode' ### Logs & Screenshots ``` └ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/__init__.py'> File "/usr/local/lib/python3.11/asyncio/threads.py", line 25, in to_thread return await loop.run_in_executor(None, func_call) │ │ └ functools.partial(<built-in method run of _contextvars.Context object at 0x7f005ae043c0>, <function get_embedding_function.<l... │ └ <function BaseEventLoop.run_in_executor at 0x7f0126a77420> └ <_UnixSelectorEventLoop running=False closed=True debug=False> File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) │ │ └ None │ └ None └ None File "/app/backend/open_webui/retrieval/utils.py", line 804, in <lambda> lambda query, prefix=None: embedding_function.encode( │ └ None └ ['Bundesgesetzblatt Teil I 2024 Ausgegeben zu Bonn am 27. November 2024 Nr. 363 Erste Verordnung zur Änderung der Ukraine-Auf... AttributeError: 'NoneType' object has no attribute 'encode' 2026-01-16 15:03:15.285 | ERROR | open_webui.routers.retrieval:process_file:1792 - 'NoneType' object has no attribute 'encode' 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 0x7f0127578ae0> └ <WorkerThread(AnyIO worker thread, started 139639033681600)> File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x7f00812e1e40> └ <WorkerThread(AnyIO worker thread, started 139639033681600)> File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 986, in run result = context.run(func, *args) │ │ │ └ () │ │ └ functools.partial(<function process_uploaded_file at 0x7f0083d21080>, <starlette.requests.Request object at 0x7f0070114410>, ... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x7f008195dfc0> File "/app/backend/open_webui/routers/files.py", line 189, in process_uploaded_file _process_handler(db_session) │ └ <sqlalchemy.orm.session.Session object at 0x7f005ad13750> └ <function process_uploaded_file.<locals>._process_handler at 0x7f005aa66e80> File "/app/backend/open_webui/routers/files.py", line 153, in _process_handler process_file( └ <function process_file at 0x7f0083d20720> > File "/app/backend/open_webui/routers/retrieval.py", line 1789, in process_file raise e └ AttributeError("'NoneType' object has no attribute 'encode'") File "/app/backend/open_webui/routers/retrieval.py", line 1750, in process_file result = save_docs_to_vector_db( └ <function save_docs_to_vector_db at 0x7f0083d20540> File "/app/backend/open_webui/routers/retrieval.py", line 1571, in save_docs_to_vector_db raise e File "/app/backend/open_webui/routers/retrieval.py", line 1542, in save_docs_to_vector_db embeddings = asyncio.run( │ └ <function run at 0x7f0126c293a0> └ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/__init__.py'> File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run return runner.run(main) │ │ └ <coroutine object get_embedding_function.<locals>.async_embedding_function at 0x7f005abd1740> │ └ <function Runner.run at 0x7f0126a78f40> └ <asyncio.runners.Runner object at 0x7f0070f69210> File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) │ │ └ <Task finished name='Task-63059' coro=<get_embedding_function.<locals>.async_embedding_function() done, defined at /app/backe... │ └ None └ <asyncio.runners.Runner object at 0x7f0070f69210> File "/usr/local/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete return future.result() │ └ <method 'result' of '_asyncio.Task' objects> └ <Task finished name='Task-63059' coro=<get_embedding_function.<locals>.async_embedding_function() done, defined at /app/backe... File "/app/backend/open_webui/retrieval/utils.py", line 802, in async_embedding_function return await asyncio.to_thread( │ └ <function to_thread at 0x7f0126a911c0> └ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/__init__.py'> File "/usr/local/lib/python3.11/asyncio/threads.py", line 25, in to_thread return await loop.run_in_executor(None, func_call) │ │ └ functools.partial(<built-in method run of _contextvars.Context object at 0x7f005ae043c0>, <function get_embedding_function.<l... │ └ <function BaseEventLoop.run_in_executor at 0x7f0126a77420> └ <_UnixSelectorEventLoop running=False closed=True debug=False> File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) │ │ └ None │ └ None └ None File "/app/backend/open_webui/retrieval/utils.py", line 804, in <lambda> lambda query, prefix=None: embedding_function.encode( │ └ None └ ['Bundesgesetzblatt Teil I 2024 Ausgegeben zu Bonn am 27. November 2024 Nr. 363 Erste Verordnung zur Änderung der Ukraine-Auf... AttributeError: 'NoneType' object has no attribute 'encode' ``` ### Additional Information What I already tried Based on similar issues and troubleshooting suggestions, I already tried the following without success: Re-saving the embedding model in Admin Settings → Documents Forcing a re-download of the model Switching the embedding provider from local (sentence-transformers) to other providers such as Ollama and OpenAI (which worked) Switching back from Ollama/OpenAI to the local embedding model → the issue persists only with the local default embedding model
GiteaMirror added the bug label 2026-04-25 08:59:09 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Jan 16, 2026):

🔍 Similar Issues Found

I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:

  1. #17005 issue: 'NoneType' object has no attribute 'encode'
    by zic04 • Aug 28, 2025 • bug

  2. #14433 issue: WebSearch does not work - 'NoneType' object has no attribute 'encode'
    by yazon • May 28, 2025 • bug


💡 Tips:

  • If this is a duplicate, please consider closing this issue and adding any additional details to the existing one
  • If you found a solution in any of these issues, please share it here to help others

This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.

<!-- gh-comment-id:3760452981 --> @owui-terminator[bot] commented on GitHub (Jan 16, 2026): 🔍 **Similar Issues Found** I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions: 1. [#17005](https://github.com/open-webui/open-webui/issues/17005) **issue: 'NoneType' object has no attribute 'encode'** *by zic04 • Aug 28, 2025 • `bug`* 2. [#14433](https://github.com/open-webui/open-webui/issues/14433) **issue: WebSearch does not work - 'NoneType' object has no attribute 'encode'** *by yazon • May 28, 2025 • `bug`* --- 💡 **Tips:** - If this is a duplicate, please consider closing this issue and adding any additional details to the existing one - If you found a solution in any of these issues, please share it here to help others *This comment was generated automatically by a bot.* Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
Author
Owner

@Classic298 commented on GitHub (Jan 16, 2026):

Disable async embedding, cannot Reproduce

<!-- gh-comment-id:3760624124 --> @Classic298 commented on GitHub (Jan 16, 2026): Disable async embedding, cannot Reproduce
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#34806