mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-14 05:02:01 -06:00
[GH-ISSUE #16616] issue: TypeError in /api/models endpoint when sorting models with null names #137704
Reference in New Issue
Block a user
Originally created by @ep9io on GitHub (Aug 14, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/16616
Check Existing Issues
Installation Method
Docker
Open WebUI Version
0.6.22
Ollama Version (if applicable)
0.11.4
Operating System
Ubuntu 24.04
Browser (if applicable)
Firefox 141.0.3 (64-bit)
Confirmation
README.md.Expected Behavior
Issue:
Root Cause:
Model sorting logic attempts to compare None values with strings, which is not supported in Python 3
Workaround/Solution:
Updated sorting key function to handle None values by providing empty string fallback:
Replaced
With
This handles cases where:
Actual Behavior
Can't access the application via the web and a stack trace is seen via the docker container logs (see stack trace in this ticket).
Steps to Reproduce
I have different connections to different providers. This could be a separate issue, but when a model comes through with no name then open-webui isn't able to handle it.
I identified the problematic models by searching for them using
model for model in models if model.get("name") is None or not model.get("name")and derived an output that would looked like the following. You can see that name is not there (None, null, etc.).{ "problematic": [ { "id": "mistral.mistral-large-latest", "object": "model", "created": 1755168352, "owned_by": "openai", "capabilities": { "completion_chat": true, "function_calling": true, "completion_fim": false, "fine_tuning": true, "vision": true, "ocr": false, "classification": false, "moderation": false, "audio": false }, "name": null, "description": "Official null Mistral AI model", "max_context_length": 262144, "aliases": [], "deprecation": null, "deprecation_replacement_model": null, "default_model_temperature": 0.3, "type": "base", "connection_type": "external", "openai": { "id": "mistral.mistral-large-latest", "object": "model", "created": 1755168352, "owned_by": "mistralai", "capabilities": { "completion_chat": true, "function_calling": true, "completion_fim": false, "fine_tuning": true, "vision": true, "ocr": false, "classification": false, "moderation": false, "audio": false }, "name": null, "description": "Official null Mistral AI model", "max_context_length": 262144, "aliases": [], "deprecation": null, "deprecation_replacement_model": null, "default_model_temperature": 0.3, "type": "base", "connection_type": "external" }, "urlIdx": 1, "actions": [], "filters": [], "tags": [] } ] }Logs & Screenshots
Stack Trace:
Firefox console log:
Additional Information
Open WEB UI runs behind NGIX reverse proxy.
Dockerfile used to create the docker container.
@amitshuklabag commented on GitHub (Aug 15, 2025):
I'm facing the same issue.
@mitchell-accipio commented on GitHub (Aug 15, 2025):
I am getting a similar error using openapi endpoints using Bedrock where I am getting very inconsistent returns; Sometimes I get a model list, sometimes I don't and I get an error;
open_webui.routers.openai:get_all_models:397 - get_all_models()
open_webui.routers.openai:send_get_request:87 - Connection error:
I am unsure if this is related or the same problem.
@ep9io commented on GitHub (Aug 15, 2025):
That sounds as it might be something else.
get_request:87 - Connection errorindicates the request didn't complete while with this ticket the response did complete, but had some null values that the app wasn't expecting. In my case, it's quite consistent.@tjbck commented on GitHub (Aug 16, 2025):
Addressed with 2387877daeaf4fa9d0c0767efa58d227ad4d1bda!