{"record":{"id":"9c624463d3619dd8","repo":"cjpais/Handy","slug":"no-model-files-found-to-delete","errorCode":null,"errorMessage":"No model files found to delete","messagePattern":"No model files found to delete","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"src-tauri/src/managers/model.rs","lineNumber":2403,"sourceCode":"                        deleted = true;\n                    }\n                }\n            }\n            // Also remove a models-dir copy (mirror fallback / manual drop-in)\n            // and any resumable partial next to it.\n            for path in [\n                self.models_dir.join(&model_info.filename),\n                self.models_dir\n                    .join(format!(\"{}.partial\", &model_info.filename)),\n            ] {\n                if path.exists() {\n                    info!(\"Deleting model file at: {:?}\", path);\n                    fs::remove_file(&path)?;\n                    deleted = true;\n                }\n            }\n            if !deleted {\n                return Err(anyhow::anyhow!(\"No model files found to delete\"));\n            }\n            // Alternate-quant entries are discovery-created (the catalog only\n            // seeds defaults), so deleting one un-discovers it rather than\n            // leaving a permanent \"(Q4_K_M)\" row in the list.\n            if is_alternate_quant {\n                self.available_models.lock().unwrap().remove(model_id);\n            }\n            self.update_download_status()?;\n            let _ = self.app_handle.emit(\"model-deleted\", model_id);\n            return Ok(());\n        }\n\n        let model_path = self.models_dir.join(&model_info.filename);\n        let partial_path = self\n            .models_dir\n            .join(format!(\"{}.partial\", &model_info.filename));\n        debug!(\"ModelManager: Model path: {:?}\", model_path);\n        debug!(\"ModelManager: Partial path: {:?}\", partial_path);","sourceCodeStart":2385,"sourceCodeEnd":2421,"githubUrl":"https://github.com/cjpais/Handy/blob/98a4d80cce8ad41efec2a419b59d9e81229a35d7/src-tauri/src/managers/model.rs#L2385-L2421","documentation":"On the Hugging Face delete branch, the code tries the HF cache snapshot pointer, the backing blob (delete_hf_cache_file), and then falls through to local file/partial checks in models_dir — none existed, so nothing was deleted. The catalog still marks the model present, but every file backing it is already gone.","triggerScenarios":"User manually cleared the HF cache (~/.cache/huggingface or HF_HOME) while the app still lists the model; the blob/snapshot layout changed under a different hf-hub cache version; a previous delete removed files but state was not refreshed.","commonSituations":"Running cache cleaners (bleachbit, rm -rf ~/.cache) with the app unaware; moving HF_HOME between runs; stale is_downloaded state after external filesystem changes.","solutions":["Trigger a model rescan / status refresh so is_downloaded reflects the missing files","If the cache was deliberately cleared, refresh the list — the entry should flip to not-downloaded and the delete becomes unnecessary","Re-download then delete if a clean state is required"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// pre-check what actually exists before deleting\nlet snapshot = hf_cached_path(repo_id, revision, filename);\nlet local = models_dir.join(&filename);\nif snapshot.is_none() && !local.exists() {\n    manager.update_download_status()?; // reconcile state; entry flips to not-downloaded\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"match manager.delete_model(id) {\n    Ok(()) => (),\n    Err(e) if e.to_string().contains(\"No model files found to delete\") => {\n        manager.update_download_status()?; // treat as already-deleted, reconcile state\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Rescan/update status after manually cleaning the HF cache","Do not delete cache contents by hand while the app is running — delete from the UI"],"tags":["rust","hf-hub","cache","delete","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"98a4d80cce8ad41efec2a419b59d9e81229a35d7","analyzedAt":"2026-08-16T20:58:09.966Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}