[PR #24228] [CLOSED] fix(retrieval): strip embedding model name to avoid silent 404 failures #82431

Closed
opened 2026-05-13 16:57:25 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24228
Author: @PHclaw
Created: 4/29/2026
Status: Closed

Base: mainHead: fix/embedding-model-strip-whitespace


📝 Commits (1)

  • 23eb403 fix(retrieval): strip embedding model name to avoid silent 404 failures (closes #24090)

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 backend/open_webui/retrieval/utils.py (+2 -2)

📄 Description

Summary

Fixes #24090

When an embedding model name has trailing/leading whitespace (e.g., qwen3-embedding-4b ), Open WebUI sends the padded string verbatim to the embedding API, resulting in a silent 404 error. The UI shows the file as "processed" but no vectors are stored.

Bug

# backend/open_webui/retrieval/utils.py line 686
json_data = {'input': texts, 'model': model}  # No strip!

If model = "qwen3-embedding-4b ", the API call becomes:

POST /v1/embeddings
{"input": [...], "model": "qwen3-embedding-4b "}

The API returns 404: Model 'qwen3-embedding-4b ' not found, but this error is silently caught and the file appears processed in the UI.

Fix

Strip whitespace from the model name in both generate_openai_batch_embeddings and agenerate_openai_batch_embeddings:

# Before
json_data = {'input': texts, 'model': model}

# After
json_data = {'input': texts, 'model': model.strip() if model else model}

This ensures that "qwen3-embedding-4b " is correctly treated as "qwen3-embedding-4b".

Testing

  1. Set embedding model to "qwen3-embedding-4b " (with trailing space) in Admin Panel
  2. Upload a file to knowledge base
  3. Before: File appears processed but no vectors stored (404 in logs)
  4. After: File is properly embedded

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/24228 **Author:** [@PHclaw](https://github.com/PHclaw) **Created:** 4/29/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/embedding-model-strip-whitespace` --- ### 📝 Commits (1) - [`23eb403`](https://github.com/open-webui/open-webui/commit/23eb403e58b01d8627ca4108a85639805f0b6350) fix(retrieval): strip embedding model name to avoid silent 404 failures (closes #24090) ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/retrieval/utils.py` (+2 -2) </details> ### 📄 Description ## Summary Fixes #24090 When an embedding model name has trailing/leading whitespace (e.g., `qwen3-embedding-4b `), Open WebUI sends the padded string verbatim to the embedding API, resulting in a silent 404 error. The UI shows the file as "processed" but no vectors are stored. ## Bug ```python # backend/open_webui/retrieval/utils.py line 686 json_data = {'input': texts, 'model': model} # No strip! ``` If `model = "qwen3-embedding-4b "`, the API call becomes: ``` POST /v1/embeddings {"input": [...], "model": "qwen3-embedding-4b "} ``` The API returns 404: `Model 'qwen3-embedding-4b ' not found`, but this error is silently caught and the file appears processed in the UI. ## Fix Strip whitespace from the model name in both `generate_openai_batch_embeddings` and `agenerate_openai_batch_embeddings`: ```python # Before json_data = {'input': texts, 'model': model} # After json_data = {'input': texts, 'model': model.strip() if model else model} ``` This ensures that `"qwen3-embedding-4b "` is correctly treated as `"qwen3-embedding-4b"`. ## Testing 1. Set embedding model to `"qwen3-embedding-4b "` (with trailing space) in Admin Panel 2. Upload a file to knowledge base 3. Before: File appears processed but no vectors stored (404 in logs) 4. After: File is properly embedded --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-13 16:57:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#82431