mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-05 18:38:17 -05:00
[GH-ISSUE #19512] issue: Regression: 'NoneType' object has no attribute 'encode' with SentenceTransformers embedding Qwen/Qwen3-Embedding-0.6B in v0.6.40 (works in v0.6.38) #57573
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 @borntoknow on GitHub (Nov 26, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/19512
Title: Regression: 'NoneType' object has no attribute 'encode' with SentenceTransformers embedding Qwen/Qwen3-Embedding-0.6B in v0.6.40 (works in v0.6.38)
Summary
After upgrading Open WebUI from v0.6.38 to v0.6.40, Knowledge Base ingestion / RAG embedding fails with:
AttributeError: 'NoneType' object has no attribute 'encode'
Same environment and configuration works on v0.6.38.
Environment
Steps to Reproduce
Expected Behavior
Embeddings are generated and stored in pgvector, document ingestion completes (as in v0.6.38).
Actual Behavior (v0.6.40)
Document embedding fails with:
AttributeError: 'NoneType' object has no attribute 'encode'
Traceback points to retrieval embedding path calling embedding_function.encode(...) where embedding_function is None.
Evidence: model works inside the container
Inside the running openwebui container:
from sentence_transformers import SentenceTransformer
m = SentenceTransformer("Qwen/Qwen3-Embedding-0.6B")
print("dim:", m.get_sentence_embedding_dimension()) # dim: 1024
print(m.encode(["ping"]).shape) # (1, 1024)
So the model + cache are valid; the failure is likely Open WebUI embedding initialization / config handling.
Notes / Observations
Stack trace (excerpt)
File "/app/backend/open_webui/retrieval/utils.py", line 792, in
lambda query, prefix=None: embedding_function.encode(
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'
Regression
Suspected Cause
Regression in get_embedding_function() / RAG config loading: embedding_function becomes None even though the SentenceTransformer model is loadable. Possibly incorrect handling of Default/SentenceTransformers embedding engine when loaded from persisted config.
Request
Please advise what changed between v0.6.38 and v0.6.40 in embedding initialization, and/or provide a fix/workaround for SentenceTransformers embedding models (specifically Qwen/Qwen3-Embedding-0.6B) so embedding_function is always initialized (not None).
@pap-prm commented on GitHub (Nov 26, 2025):
@mahenning commented on GitHub (Nov 26, 2025):
I have the same problem, and when changing/saving my embedding model, I get in my docker logs:
This message is only displayed when the log level is debug, so it's hidden normally. But the behavior afterwards is the same, I can't process documents anymore and get the
AttributeError: 'NoneType' object has no attribute 'encode'message.Fix:
https://github.com/huggingface/transformers/issues/42374
The
transformersversion 4.57.2 used inopen-webui0.6.40 has a bug that is already fixed in versiontransformers4.57.3.open-webuishould update its dependencies fortransformersto fix this.I also build 0.6.40 in a cloned git project, and the dependency there is
transformers4.57.0 (probably from an older build), and there I dont get the errors above.Edit: I tested it in the cloned project with
open-webuiv0.6.40 andtransfomerswith the versions 4.57.0, 4.57.2, 4.57.3. With 4.57.2, I get the errors I mentioned above, with the other two versions I don't get any errors and document uploading is working again.@Classic298 commented on GitHub (Nov 26, 2025):
Thanks, i will open a PR to update the dependency @mahenning
@borntoknow commented on GitHub (Nov 26, 2025):
Thanks — confirmed.
I had the same regression after upgrading from 0.6.38 to 0.6.40:
Error loading SentenceTransformer: 'dict' object has no attribute 'model_type'AttributeError: 'NoneType' object has no attribute 'encode'Temporary workaround on my side:
transformers==4.57.3(instead of 4.57.2)Qwen/Qwen3-Embedding-0.6B.So yes, updating Open WebUI deps to transformers 4.57.3 should fix it permanently. Thanks for the pointer and the upstream link.
@Classic298 commented on GitHub (Nov 26, 2025):
https://github.com/open-webui/open-webui/pull/19513
@Classic298 commented on GitHub (Nov 26, 2025):
thanks for testing and confirming guys
this is how we can solve issues quickly
@Classic298 commented on GitHub (Nov 26, 2025):
Version is pinned in dev
Anyone who still has this issue should reinstall their version. As of .40 the version is still unpinned and therefore it should fetch the latest version which is a working version.
@mahenning commented on GitHub (Nov 27, 2025):
Is it possible to yank the docker version, or at least release 0.6.41 fast with the fix? I still remember v0.6.33 where focused retrieval mode was broken, and the fix was there 1d after but needed like a week to be released into a new version. I suppose that most people use docker and changing the transformers version there is not trivial.
0.6.40 was also a hotfix on the same day, so it is possible in your release cycle.
@Classic298 commented on GitHub (Nov 27, 2025):
@mahenning the version itself works. If you install it now you will not run into issues. On .40 the version is still unpinned, meaning you would install the latest version of the transformers depencency - and the latest version works.
@mahenning commented on GitHub (Nov 27, 2025):
Your 0.6.40 docker image has all it's dependencies already installed, and one dependency is
transformers4.57.2. Thats the whole point of docker images, that everything is already packaged. Meaning everyone who pulls your 0.6.40 image gets the bugged transformer version. Yes, you can build a new docker image on top of that which updates this dep but most people wont do that.You statement is only true for people who build open-webui locally.
@Classic298 commented on GitHub (Nov 27, 2025):
@mahenning yes i meant for pip or local git installations - for docker: i asked tim to perhaps rebuild the :main docker image. Then .41 would not be urgently needed.
@Classic298 commented on GitHub (Nov 27, 2025):
@mahenning
https://github.com/open-webui/open-webui/actions/runs/19667243130
@mahenning commented on GitHub (Nov 27, 2025):
I re-pulled the image, it's still the same transformers version. And when I read the build logs right, it used a cached version of the layer that installs the pip/uv dependencies, which means it never pulls/installs the newest transformers version:
@Classic298 commented on GitHub (Nov 27, 2025):
thanks, fw'ed