[PR #24128] [CLOSED] fix: strip whitespace from embedding model name before API calls #43144

Closed
opened 2026-04-25 14:49:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24128
Author: @SymbolStar
Created: 4/25/2026
Status: Closed

Base: mainHead: fix/embedding-model-name-trim


📝 Commits (1)

  • 768f049 fix: strip whitespace from embedding model name before API calls (#24090)

📊 Changes

1 file changed (+5 additions, -0 deletions)

View changed files

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

📄 Description

Summary

Fixes #24090 — When the embedding model name is configured with trailing/leading whitespace in the Admin Panel (e.g. qwen3-embedding-4b ), the padded string is sent verbatim to the embedding endpoint, causing silent 404 errors. File uploads appear successful in the UI but no vectors are stored.

Root Cause

The model name from the admin settings is used as-is in the API request body without trimming. Extra whitespace causes the embedding provider to return 404 (Model 'qwen3-embedding-4b ' not found).

Fix

Add model = model.strip() at the entry point of all five embedding functions in retrieval/utils.py:

  • generate_openai_batch_embeddings
  • agenerate_openai_batch_embeddings
  • generate_ollama_batch_embeddings
  • agenerate_ollama_batch_embeddings
  • generate_embeddings (top-level async dispatcher)

This is defense-in-depth — the model name is trimmed regardless of which embedding engine or code path is used.

Testing

  • Model name qwen3-embedding-4b (trailing space) → trimmed to qwen3-embedding-4b → embedding succeeds
  • Model name qwen3-embedding-4b (no whitespace) → unchanged

🔄 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/24128 **Author:** [@SymbolStar](https://github.com/SymbolStar) **Created:** 4/25/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/embedding-model-name-trim` --- ### 📝 Commits (1) - [`768f049`](https://github.com/open-webui/open-webui/commit/768f0497880ebcf93e61b6ea41c3c2fc3cb8ba2b) fix: strip whitespace from embedding model name before API calls (#24090) ### 📊 Changes **1 file changed** (+5 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/retrieval/utils.py` (+5 -0) </details> ### 📄 Description ## Summary Fixes #24090 — When the embedding model name is configured with trailing/leading whitespace in the Admin Panel (e.g. `qwen3-embedding-4b `), the padded string is sent verbatim to the embedding endpoint, causing silent 404 errors. File uploads appear successful in the UI but no vectors are stored. ## Root Cause The model name from the admin settings is used as-is in the API request body without trimming. Extra whitespace causes the embedding provider to return 404 (`Model 'qwen3-embedding-4b ' not found`). ## Fix Add `model = model.strip()` at the entry point of all five embedding functions in `retrieval/utils.py`: - `generate_openai_batch_embeddings` - `agenerate_openai_batch_embeddings` - `generate_ollama_batch_embeddings` - `agenerate_ollama_batch_embeddings` - `generate_embeddings` (top-level async dispatcher) This is defense-in-depth — the model name is trimmed regardless of which embedding engine or code path is used. ## Testing - Model name `qwen3-embedding-4b ` (trailing space) → trimmed to `qwen3-embedding-4b` → embedding succeeds ✅ - Model name `qwen3-embedding-4b` (no whitespace) → unchanged ✅ --- <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-04-25 14:49:45 -05:00
GiteaMirror changed title from [PR #24128] fix: strip whitespace from embedding model name before API calls to [PR #24128] [CLOSED] fix: strip whitespace from embedding model name before API calls 2026-04-30 03:16:47 -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#43144