mirror of
https://github.com/open-webui/open-webui.git
synced 2026-06-09 11:45:57 -05:00
[PR #21235] [CLOSED] fix: validate and normalize model tags to prevent UI crash #97019
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21235
Author: @veeceey
Created: 2/7/2026
Status: ❌ Closed
Base:
main← Head:fix/issue-20819-model-tags-validation📝 Commits (1)
8a909a8fix: validate model tags to prevent UI crash on malformed input📊 Changes
2 files changed (+25 additions, -6 deletions)
View changed files
📝
backend/open_webui/models/models.py(+15 -2)📝
backend/open_webui/routers/models.py(+10 -4)📄 Description
Summary
/api/modelsendpoint and/api/v1/models/tagsdon't crash when tags are stored as plain strings (e.g.,["tag1", "tag2"]) instead of the expected[{"name": "tag1"}]formatmodel_validatortoModelMetathat normalizes string tags to dict format on inputget_model_tagsto handle both formats gracefullyRoot Cause
Direct API calls to
/api/v1/models/model/updatecan save tags in any format since there's no backend validation. When incorrectly formatted tags (plain strings) are stored, theget_model_tagsendpoint crashes withAttributeError: 'str' object has no attribute 'get'becausetag.get('name')fails on string objects. This causes a 500 error on the models list API, leaving the UI stuck in an infinite loading state.Test Results
Before fix: API call with string tags causes 500 Internal Server Error, UI shows infinite loading.
After fix: String tags are auto-normalized to the correct format. Existing data with string tags is handled gracefully.
Fixes #20819
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.