From 882cabc7d2d32a027139bafd9d38c914f93a643d Mon Sep 17 00:00:00 2001 From: Chris Chen Date: Sat, 18 Apr 2026 20:13:06 +1000 Subject: [PATCH] fix: warn user when no models to migrate during storage change (#433) When user attempts to change model storage location with no models downloaded, the migration API returns moved=0 early. Previously the UI would still call setCustomModelsDir() and restart the server, causing unexpected behavior (hang/connection lost). This change checks migrationResult.moved === 0 and shows a helpful toast message instead of proceeding with the storage change. Fixes: #426 Co-authored-by: fuleinist --- .../components/ServerSettings/ModelManagement.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/components/ServerSettings/ModelManagement.tsx b/app/src/components/ServerSettings/ModelManagement.tsx index d3fe24fa..9893984d 100644 --- a/app/src/components/ServerSettings/ModelManagement.tsx +++ b/app/src/components/ServerSettings/ModelManagement.tsx @@ -977,7 +977,19 @@ export function ModelManagement() { }); try { // Start the migration (background task) - await apiClient.migrateModels(newDir); + const migrationResult = await apiClient.migrateModels(newDir); + + // If no models to migrate, warn user and skip the change + if (migrationResult.moved === 0) { + setMigrating(false); + setMigrationProgress(null); + toast({ + title: 'No models to migrate', + description: 'Download at least one model before changing the storage location.', + }); + setPendingMigrateDir(null); + return; + } // Connect to SSE for progress await new Promise((resolve, reject) => {