issue: NameError: name 'api_config' is not defined in /ollama/api/embed Route (Versions > v0.6.5) #5070

Closed
opened 2025-11-11 16:11:23 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @pranitl on GitHub (May 6, 2025).

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

0.6.5

Ollama Version (if applicable)

No response

Operating System

MacOS Sequoia 15.4.1

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 listed steps to reproduce the bug in detail.

Expected Behavior

The /ollama/api/embed request should be successfully proxied to the Ollama backend, and the Ollama backend's response (embeddings or an error from Ollama itself) should be returned to the client with a 2xx status code.

Actual Behavior

When a POST request is made to the /ollama/api/embed endpoint (proxied by OpenWebUI), OpenWebUI returns a 500 Internal Server Error. The OpenWebUI server logs show a NameError: name 'api_config' is not defined occurring within its internal routing logic for this specific endpoint.

OpenWebUI returns a 500 Internal Server Error due to an internal NameError.
Relevant Server Log Snippet (from OpenWebUI when the error occurs):

File "/app/backend/open_webui/routers/ollama.py", line 888, in embed  # Line number might vary slightly by version
    prefix_id = api_config.get("prefix_id", None)
                ^^^^^^^^^^
NameError: name 'api_config' is not defined

Steps to Reproduce

  1. Send a POST request to the OpenWebUI instance at the path /ollama/api/embed.
    Here is a curl command:
        curl -X 'POST' \
          'http://[YOUR_OPENWEBUI_URL]/ollama/api/embed' \
          -H 'accept: application/json' \
          -H 'Content-Type: application/json' \
          -d '{
                "model": "mxbai-embed-large",
                "input": ["this is a test sentence to embed"],
                "truncate": true
              }'
'
2. Observe the 500 Internal Server Error HTTP response.
3. Check the OpenWebUI server logs for the NameError.

### Logs & Screenshots

[openwebui-docker-logs.txt](https://github.com/user-attachments/files/20067924/openwebui-docker-logs.txt)


### Additional Information

This bug prevents applications from using the /ollama/api/embed endpoint when proxied through affected versions of OpenWebUI. Downgrading OpenWebUI to v0.6.5 resolved this specific issue, indicating a regression or a bug introduced in subsequent versions. The underlying Ollama backend itself was functioning correctly and able to serve embedding requests when accessed directly or via the working v0.6.5 proxy.
Originally created by @pranitl on GitHub (May 6, 2025). ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version 0.6.5 ### Ollama Version (if applicable) _No response_ ### Operating System MacOS Sequoia 15.4.1 ### 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 listed steps to reproduce the bug in detail. ### Expected Behavior The /ollama/api/embed request should be successfully proxied to the Ollama backend, and the Ollama backend's response (embeddings or an error from Ollama itself) should be returned to the client with a 2xx status code. ### Actual Behavior When a POST request is made to the /ollama/api/embed endpoint (proxied by OpenWebUI), OpenWebUI returns a 500 Internal Server Error. The OpenWebUI server logs show a NameError: name 'api_config' is not defined occurring within its internal routing logic for this specific endpoint. OpenWebUI returns a 500 Internal Server Error due to an internal NameError. Relevant Server Log Snippet (from OpenWebUI when the error occurs): ``` File "/app/backend/open_webui/routers/ollama.py", line 888, in embed # Line number might vary slightly by version prefix_id = api_config.get("prefix_id", None) ^^^^^^^^^^ NameError: name 'api_config' is not defined ``` ### Steps to Reproduce 1. Send a POST request to the OpenWebUI instance at the path /ollama/api/embed. Here is a curl command: ``` curl -X 'POST' \ 'http://[YOUR_OPENWEBUI_URL]/ollama/api/embed' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "model": "mxbai-embed-large", "input": ["this is a test sentence to embed"], "truncate": true }' ' 2. Observe the 500 Internal Server Error HTTP response. 3. Check the OpenWebUI server logs for the NameError. ### Logs & Screenshots [openwebui-docker-logs.txt](https://github.com/user-attachments/files/20067924/openwebui-docker-logs.txt) ### Additional Information This bug prevents applications from using the /ollama/api/embed endpoint when proxied through affected versions of OpenWebUI. Downgrading OpenWebUI to v0.6.5 resolved this specific issue, indicating a regression or a bug introduced in subsequent versions. The underlying Ollama backend itself was functioning correctly and able to serve embedding requests when accessed directly or via the working v0.6.5 proxy.
GiteaMirror added the bug label 2025-11-11 16:11:23 -06:00
Author
Owner

@tjbck commented on GitHub (May 6, 2025):

Already addressed in dev, 0.6.7 imminent.

@tjbck commented on GitHub (May 6, 2025): Already addressed in dev, 0.6.7 imminent.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#5070