I'm encountering an error when attempting to upload files through UI, as indicated by the following message: 'NoneType object has no attribute "encode"'.
To better understand the issue, I've included some additional details below.
UI Screen print:
UI Resonse:
Backend Request:
Backend Response:
Platform: Windows 10 Browser: Chrome - 131.0.6778.86 (Official Build) (64-bit) Open WebUI: 0.4.7
Attachment:
Note: I tried after cleaning the browser cookies as well but no luck.
Originally created by @prasadautomationtesting on GitHub (Dec 3, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/7564
I'm encountering an error when attempting to upload files through UI, as indicated by the following message: '**NoneType object has no attribute "encode"**'.
To better understand the issue, I've included some additional details below.
**UI Screen print:**
<img width="616" alt="NoneType Error" src="https://github.com/user-attachments/assets/86dc6377-1ab7-47b5-a4ce-5f772c9ae29c">
**UI Resonse:**
<img width="583" alt="UI Response" src="https://github.com/user-attachments/assets/dc58bd32-edc0-4b48-837d-54ca61c0ca35">
**Backend Request:**
<img width="347" alt="Request" src="https://github.com/user-attachments/assets/41679630-3e62-4254-9e33-8bcbe90bf3ad">
**Backend Response:**
<img width="358" alt="Response" src="https://github.com/user-attachments/assets/910cc4e9-dd4c-4dbd-b9c0-a5befaf3311f">
**Platform:** Windows 10
**Browser**: Chrome - 131.0.6778.86 (Official Build) (64-bit)
**Open WebUI:** 0.4.7
**Attachment:**

Note: I tried after cleaning the browser cookies as well but no luck.
I had this error. It seems that in my case, the error was caused by the Embedding Model in the Admin Panel. I had to retype the default embedding model and then press the button on the right. After that, the error disappeared.
<!-- gh-comment-id:2517614329 -->
@Simi5599 commented on GitHub (Dec 4, 2024):
I had this error. It seems that in my case, the error was caused by the Embedding Model in the Admin Panel. I had to retype the default embedding model and then press the button on the right. After that, the error disappeared.

@prasadautomationtesting commented on GitHub (Dec 4, 2024):
@Simi5599 : It works for me too after following your workaround. Thanks!
Nevertheless, keeping the defect opened for the fix.
<!-- gh-comment-id:2517675543 -->
@prasadautomationtesting commented on GitHub (Dec 4, 2024):
@Simi5599 : It works for me too after following your workaround. Thanks!
Nevertheless, keeping the defect opened for the fix.
I am looking for the source code to see if i can get this to work or maybe the maintainer of the repo will do this before me ;)
<!-- gh-comment-id:2517682905 -->
@Simi5599 commented on GitHub (Dec 4, 2024):
I am looking for the source code to see if i can get this to work or maybe the maintainer of the repo will do this before me ;)
In the file located in /backend/open_webui/apps/retrieval/main.py I made the following corrections:
I created a variable default_embedding_model="sentence-transformers/all-MiniLM-L6-v2"
In the function save_docs_to_vector_db I added the following lines at the very beginning:
If the embedding model is empty i am setting it back to the default value
if not app.state.config.RAG_EMBEDDING_MODEL or app.state.config.RAG_EMBEDDING_MODEL.strip() == "":
app.state.config.RAG_EMBEDDING_MODEL=default_embedding_model
update_embedding_model(app.state.config.RAG_EMBEDDING_MODEL)
app.state.EMBEDDING_FUNCTION = get_embedding_function(
app.state.config.RAG_EMBEDDING_ENGINE,
app.state.config.RAG_EMBEDDING_MODEL,
app.state.sentence_transformer_ef,
(
app.state.config.OPENAI_API_BASE_URL
if app.state.config.RAG_EMBEDDING_ENGINE == "openai"
else app.state.config.OLLAMA_BASE_URL
),
(
app.state.config.OPENAI_API_KEY
if app.state.config.RAG_EMBEDDING_ENGINE == "openai"
else app.state.config.OLLAMA_API_KEY
),
app.state.config.RAG_EMBEDDING_BATCH_SIZE,
)
log.info(f"Embedding model was empty. Set to default: {default_embedding_model}")
The code basically resets the empty RAG_EMBEDDING_MODEL to the default value stored in a variable.
If @tjbck can review this, I can create a PR or let him handle the commit ;)
PROOF:
Let's set the Embedding Model to "" to recreate the issue
Let's feed the LMM with a .pdf file and ask a question
We can observe that the Embedding Model has beed restored to the default value
<!-- gh-comment-id:2518679586 -->
@Simi5599 commented on GitHub (Dec 4, 2024):
UPDATE: I think i did it!
In the file located in `/backend/open_webui/apps/retrieval/main.py` I made the following corrections:
1. I created a variable `default_embedding_model="sentence-transformers/all-MiniLM-L6-v2"`
2. In the function `save_docs_to_vector_db` I added the following lines at the very beginning:
# If the embedding model is empty i am setting it back to the default value
if not app.state.config.RAG_EMBEDDING_MODEL or app.state.config.RAG_EMBEDDING_MODEL.strip() == "":
app.state.config.RAG_EMBEDDING_MODEL=default_embedding_model
update_embedding_model(app.state.config.RAG_EMBEDDING_MODEL)
app.state.EMBEDDING_FUNCTION = get_embedding_function(
app.state.config.RAG_EMBEDDING_ENGINE,
app.state.config.RAG_EMBEDDING_MODEL,
app.state.sentence_transformer_ef,
(
app.state.config.OPENAI_API_BASE_URL
if app.state.config.RAG_EMBEDDING_ENGINE == "openai"
else app.state.config.OLLAMA_BASE_URL
),
(
app.state.config.OPENAI_API_KEY
if app.state.config.RAG_EMBEDDING_ENGINE == "openai"
else app.state.config.OLLAMA_API_KEY
),
app.state.config.RAG_EMBEDDING_BATCH_SIZE,
)
log.info(f"Embedding model was empty. Set to default: {default_embedding_model}")
The code basically resets the empty `RAG_EMBEDDING_MODEL` to the default value stored in a variable.
If @tjbck can review this, I can create a PR or let him handle the commit ;)
PROOF:
1. Let's set the Embedding Model to "" to recreate the issue 
2. Let's feed the LMM with a .pdf file and ask a question 
3. We can observe that the Embedding Model has beed restored to the default value

Apparantly this can also be triggered if the embedding model could not be downloaded due to bad network conditions.
<!-- gh-comment-id:2523926650 -->
@i0ntempest commented on GitHub (Dec 6, 2024):
Apparantly this can also be triggered if the embedding model could not be downloaded due to bad network conditions.
Sometimes I encounter this issue even without modifying the embedding model configuration, and it only returns to normal after resetting the vector database.
<!-- gh-comment-id:2559364601 -->
@GrayXu commented on GitHub (Dec 23, 2024):
Sometimes I encounter this issue even without modifying the embedding model configuration, and it only returns to normal after resetting the vector database.
Sometimes I encounter this issue even without modifying the embedding model configuration, and it only returns to normal after resetting the vector database.
<!-- gh-comment-id:2561583290 -->
@silentoplayz commented on GitHub (Dec 25, 2024):
> Sometimes I encounter this issue even without modifying the embedding model configuration, and it only returns to normal after resetting the vector database.
This issue has been possibly fixed on the `dev` branch with this commit: https://github.com/open-webui/open-webui/commit/4b7f0c5be11ef437301f9ffa5c68fc52fbb37516
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @prasadautomationtesting on GitHub (Dec 3, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/7564
I'm encountering an error when attempting to upload files through UI, as indicated by the following message: 'NoneType object has no attribute "encode"'.
To better understand the issue, I've included some additional details below.
UI Screen print:
UI Resonse:
Backend Request:
Backend Response:
Platform: Windows 10
Browser: Chrome - 131.0.6778.86 (Official Build) (64-bit)
Open WebUI: 0.4.7
Attachment:
Note: I tried after cleaning the browser cookies as well but no luck.
@Jazzy96 commented on GitHub (Dec 4, 2024):
I have encountered it as well. v0.4.7
@Simi5599 commented on GitHub (Dec 4, 2024):
I had this error. It seems that in my case, the error was caused by the Embedding Model in the Admin Panel. I had to retype the default embedding model and then press the button on the right. After that, the error disappeared.
@prasadautomationtesting commented on GitHub (Dec 4, 2024):
@Simi5599 : It works for me too after following your workaround. Thanks!
Nevertheless, keeping the defect opened for the fix.
@Simi5599 commented on GitHub (Dec 4, 2024):
I am looking for the source code to see if i can get this to work or maybe the maintainer of the repo will do this before me ;)
@Simi5599 commented on GitHub (Dec 4, 2024):
UPDATE: I think i did it!
In the file located in
/backend/open_webui/apps/retrieval/main.pyI made the following corrections:I created a variable
default_embedding_model="sentence-transformers/all-MiniLM-L6-v2"In the function
save_docs_to_vector_dbI added the following lines at the very beginning:If the embedding model is empty i am setting it back to the default value
The code basically resets the empty
RAG_EMBEDDING_MODELto the default value stored in a variable.If @tjbck can review this, I can create a PR or let him handle the commit ;)
PROOF:
@i0ntempest commented on GitHub (Dec 6, 2024):
Apparantly this can also be triggered if the embedding model could not be downloaded due to bad network conditions.
@GrayXu commented on GitHub (Dec 23, 2024):
Sometimes I encounter this issue even without modifying the embedding model configuration, and it only returns to normal after resetting the vector database.
@silentoplayz commented on GitHub (Dec 25, 2024):
This issue has been possibly fixed on the
devbranch with this commit: https://github.com/open-webui/open-webui/commit/4b7f0c5be11ef437301f9ffa5c68fc52fbb37516