[GH-ISSUE #20292] issue: [BUG] Error 500 /api/models block when OLLAMA_BASE_URLS contains an unreachable IP #138872

Closed
opened 2026-05-25 11:48:06 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @netgabo on GitHub (Dec 31, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/20292

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.43

Ollama Version (if applicable)

None (Issue occurs when Ollama is not present but a ghost IP is configured)

Operating System

Debian/Ubuntu (CasaOS Environment) ZimaOS

Browser (if applicable)

Chrome / Firefox

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 provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

If a configured OLLAMA_BASE_URLS or OPENAI_API_BASE_URLS endpoint is unreachable, the backend should handle the connection timeout gracefully. The /api/models endpoint should return the available models from working connections (or an empty list) instead of failing with a 500 Internal Server Error. Users should always be able to access the Settings UI to correct invalid configurations.

Actual Behavior

When an unreachable IP (e.g., 192.168.0.109) is present in the connection settings, the backend attempts to fetch models and fails. This results in a 500 Internal Server Error for the /api/models call. Since the frontend Settings menu depends on this call to load, the UI becomes unresponsive or blocked, creating a "deadlock" where the user cannot fix the incorrect IP through the web interface.

Steps to Reproduce

  1. Install Open WebUI via Docker.

  2. Go to Settings > Connections and add an unreachable IP to Ollama or OpenAI base URLs (e.g., http://192.168.0.109:11434 + http://host.docker.internal:11434) .

  3. Save and restart the container.

  4. Attempt to log in and open the Settings menu.

  5. The UI will show an error or spin indefinitely. Checking the browser console and Docker logs will reveal a 500 Error on GET /api/models.

End: There is no way to revert this change via UI; only manual database manipulation (SQLite) fixes it.

Logs & Screenshots

ERROR | open_webui.routers.openai:send_get_request:83 - Connection error: Cannot connect to host 192.168.0.109:1234 ssl:default [Connect call failed ('192.168.0.109', 1234)]
ERROR | open_webui.routers.ollama:send_get_request:99 - Connection error: Cannot connect to host 192.168.0.109:11434 ssl:default [Connect call failed ('192.168.0.109', 11434)]
INFO | uvicorn.protocols.http.httptools_impl:send:476 - "GET /api/models HTTP/1.1" 500

Database Inspection (using grep on webui.db): The unreachable IP was found persisted in a large JSON string within the config table, preventing successful initialization even after changing environment variables, as the database values took precedence.

Additional Information

Manual Workaround used to recover: To fix this, I had to stop the container and manually clear the config table using: sqlite3 webui.db "DELETE FROM config WHERE id LIKE '%urls%';" This confirms the issue is that the backend does not ignore or timeout quickly enough on invalid database-stored endpoints, causing a total UI lockout.

Originally created by @netgabo on GitHub (Dec 31, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/20292 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.43 ### Ollama Version (if applicable) None (Issue occurs when Ollama is not present but a ghost IP is configured) ### Operating System Debian/Ubuntu (CasaOS Environment) ZimaOS ### Browser (if applicable) Chrome / Firefox ### 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 **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior If a configured OLLAMA_BASE_URLS or OPENAI_API_BASE_URLS endpoint is unreachable, the backend should handle the connection timeout gracefully. The /api/models endpoint should return the available models from working connections (or an empty list) instead of failing with a 500 Internal Server Error. Users should always be able to access the Settings UI to correct invalid configurations. ### Actual Behavior When an unreachable IP (e.g., 192.168.0.109) is present in the connection settings, the backend attempts to fetch models and fails. This results in a 500 Internal Server Error for the /api/models call. Since the frontend Settings menu depends on this call to load, the UI becomes unresponsive or blocked, creating a "deadlock" where the user cannot fix the incorrect IP through the web interface. ### Steps to Reproduce 1. Install Open WebUI via Docker. 2. Go to Settings > Connections and add an unreachable IP to Ollama or OpenAI base URLs (e.g., http://192.168.0.109:11434 + http://host.docker.internal:11434) . 3. Save and restart the container. 4. Attempt to log in and open the Settings menu. 5. The UI will show an error or spin indefinitely. Checking the browser console and Docker logs will reveal a 500 Error on GET /api/models. End: There is no way to revert this change via UI; only manual database manipulation (SQLite) fixes it. ### Logs & Screenshots ERROR | open_webui.routers.openai:send_get_request:83 - Connection error: Cannot connect to host 192.168.0.109:1234 ssl:default [Connect call failed ('192.168.0.109', 1234)] ERROR | open_webui.routers.ollama:send_get_request:99 - Connection error: Cannot connect to host 192.168.0.109:11434 ssl:default [Connect call failed ('192.168.0.109', 11434)] INFO | uvicorn.protocols.http.httptools_impl:send:476 - "GET /api/models HTTP/1.1" 500 Database Inspection (using grep on webui.db): The unreachable IP was found persisted in a large JSON string within the config table, preventing successful initialization even after changing environment variables, as the database values took precedence. ### Additional Information Manual Workaround used to recover: To fix this, I had to stop the container and manually clear the config table using: sqlite3 webui.db "DELETE FROM config WHERE id LIKE '%urls%';" This confirms the issue is that the backend does not ignore or timeout quickly enough on invalid database-stored endpoints, causing a total UI lockout.
GiteaMirror added the bug label 2026-05-25 11:48:06 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Dec 31, 2025):

🔍 Similar Issues Found

I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:

  1. #19755 issue: Error: 404, message='Not Found', url='http://ollama:11434/api/embed'
    by stevewillett • Dec 04, 2025 • bug

  2. #20290 issue:
    by rldet9 • Dec 31, 2025 • bug

  3. #19496 issue: 500 internal server error appears in v0.6.40
    by cloudtuotuo • Nov 26, 2025 • bug

  4. #19575 issue: Remove / delete Ollama models not possible - Error occurred
    by JoeyVinc • Nov 28, 2025 • bug

  5. #19188 issue: Model drop-down fails to show models from remote hosts (ollama, llama.cpp)
    by d-shehu • Nov 14, 2025 • bug

Show 5 more related issues
  1. #16255 issue: 404: Model not found
    by wade3po • Aug 04, 2025 • bug

  2. #18975 issue: 500: Internal Error
    by nurb2kea • Nov 06, 2025 • bug

  3. #11972 issue: not found ollama models after ollama upgrade
    by SquirrelJimmy • Mar 23, 2025 • bug

  4. #11990 issue: OLLAMA_BASE_URL being passed as OLLAMA_API_BASE_URL
    by deboboy • Mar 23, 2025 • bug

  5. #19563 issue:
    by naruto7g • Nov 28, 2025 • bug


💡 Tips:

  • If this is a duplicate, please consider closing this issue and adding any additional details to the existing one
  • If you found a solution in any of these issues, please share it here to help others

This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.

<!-- gh-comment-id:3702035281 --> @owui-terminator[bot] commented on GitHub (Dec 31, 2025): 🔍 **Similar Issues Found** I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions: 1. [#19755](https://github.com/open-webui/open-webui/issues/19755) **issue: Error: 404, message='Not Found', url='http://ollama:11434/api/embed'** *by stevewillett • Dec 04, 2025 • `bug`* 2. [#20290](https://github.com/open-webui/open-webui/issues/20290) **issue:** *by rldet9 • Dec 31, 2025 • `bug`* 3. [#19496](https://github.com/open-webui/open-webui/issues/19496) **issue: 500 internal server error appears in v0.6.40** *by cloudtuotuo • Nov 26, 2025 • `bug`* 4. [#19575](https://github.com/open-webui/open-webui/issues/19575) **issue: Remove / delete Ollama models not possible - Error occurred** *by JoeyVinc • Nov 28, 2025 • `bug`* 5. [#19188](https://github.com/open-webui/open-webui/issues/19188) **issue: Model drop-down fails to show models from remote hosts (ollama, llama.cpp)** *by d-shehu • Nov 14, 2025 • `bug`* <details> <summary>Show 5 more related issues</summary> 6. [#16255](https://github.com/open-webui/open-webui/issues/16255) **issue: 404: Model not found** *by wade3po • Aug 04, 2025 • `bug`* 7. [#18975](https://github.com/open-webui/open-webui/issues/18975) **issue: 500: Internal Error** *by nurb2kea • Nov 06, 2025 • `bug`* 8. [#11972](https://github.com/open-webui/open-webui/issues/11972) **issue: not found ollama models after ollama upgrade** *by SquirrelJimmy • Mar 23, 2025 • `bug`* 9. [#11990](https://github.com/open-webui/open-webui/issues/11990) **issue: OLLAMA_BASE_URL being passed as OLLAMA_API_BASE_URL** *by deboboy • Mar 23, 2025 • `bug`* 10. [#19563](https://github.com/open-webui/open-webui/issues/19563) **issue:** *by naruto7g • Nov 28, 2025 • `bug`* </details> --- 💡 **Tips:** - If this is a duplicate, please consider closing this issue and adding any additional details to the existing one - If you found a solution in any of these issues, please share it here to help others *This comment was generated automatically by a bot.* Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
Author
Owner

@tjbck commented on GitHub (Dec 31, 2025):

You can configure this behaviour with an env var.

<!-- gh-comment-id:3702233784 --> @tjbck commented on GitHub (Dec 31, 2025): You can configure this behaviour with an env var.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#138872