From cb7d7e851d160bfc866aca9385c8a8013dd10192 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 21 Oct 2026 23:12:10 +0200 Subject: [PATCH] fix: model import silently skips a model whose ID is already taken (#32866) Importing a model JSON on the Workspace Models page as a regular user skipped any model whose ID already belonged to another user's model they cannot edit, or to a model from one of the instance's connections such as OpenAI or Ollama. There was no message, so the model just never showed up. The import now stops at that model with the error "Uh-oh! This model id is already registered. Please choose another model id string."; the models before it in the file are imported and the ones after it are not. Admins, and users who can edit the existing model, are unaffected and still overwrite it. --- backend/open_webui/routers/models.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/backend/open_webui/routers/models.py b/backend/open_webui/routers/models.py index b7e23e8cd3..3a01d367d8 100644 --- a/backend/open_webui/routers/models.py +++ b/backend/open_webui/routers/models.py @@ -580,12 +580,10 @@ async def import_models( and existing_model.user_id != user.id and model_id not in writable_model_ids ): - log.warning( - 'import_models: user %s skipped model %s (no write access)', - user.id, - model_id, + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, + detail=ERROR_MESSAGES.MODEL_ID_TAKEN, ) - continue if ( user.role != 'admin' @@ -648,12 +646,10 @@ async def import_models( base_model_ids.add(base_model_id.split(':', 1)[0]) if model_id in base_model_ids: - log.warning( - 'import_models: user %s skipped model %s (id belongs to a base model)', - user.id, - model_id, + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, + detail=ERROR_MESSAGES.MODEL_ID_TAKEN, ) - continue new_model.access_grants = await filter_allowed_access_grants( await Config.get('user.permissions'),