cjpais/Handy · warning · anyhow::Error

No model files found to delete

Error message

No model files found to delete

What it means

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.

Source

Thrown at src-tauri/src/managers/model.rs:2403

                        deleted = true;
                    }
                }
            }
            // Also remove a models-dir copy (mirror fallback / manual drop-in)
            // and any resumable partial next to it.
            for path in [
                self.models_dir.join(&model_info.filename),
                self.models_dir
                    .join(format!("{}.partial", &model_info.filename)),
            ] {
                if path.exists() {
                    info!("Deleting model file at: {:?}", path);
                    fs::remove_file(&path)?;
                    deleted = true;
                }
            }
            if !deleted {
                return Err(anyhow::anyhow!("No model files found to delete"));
            }
            // Alternate-quant entries are discovery-created (the catalog only
            // seeds defaults), so deleting one un-discovers it rather than
            // leaving a permanent "(Q4_K_M)" row in the list.
            if is_alternate_quant {
                self.available_models.lock().unwrap().remove(model_id);
            }
            self.update_download_status()?;
            let _ = self.app_handle.emit("model-deleted", model_id);
            return Ok(());
        }

        let model_path = self.models_dir.join(&model_info.filename);
        let partial_path = self
            .models_dir
            .join(format!("{}.partial", &model_info.filename));
        debug!("ModelManager: Model path: {:?}", model_path);
        debug!("ModelManager: Partial path: {:?}", partial_path);

View on GitHub (pinned to 98a4d80cce)

Solutions

  1. Trigger a model rescan / status refresh so is_downloaded reflects the missing files
  2. If the cache was deliberately cleared, refresh the list — the entry should flip to not-downloaded and the delete becomes unnecessary
  3. Re-download then delete if a clean state is required
Defensive patterns

Strategy: validation

Validate before calling

// pre-check what actually exists before deleting
let snapshot = hf_cached_path(repo_id, revision, filename);
let local = models_dir.join(&filename);
if snapshot.is_none() && !local.exists() {
    manager.update_download_status()?; // reconcile state; entry flips to not-downloaded
    return Ok(());
}

Try / catch

match manager.delete_model(id) {
    Ok(()) => (),
    Err(e) if e.to_string().contains("No model files found to delete") => {
        manager.update_download_status()?; // treat as already-deleted, reconcile state
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: Running cache cleaners (bleachbit, rm -rf ~/.cache) with the app unaware; moving HF_HOME between runs; stale is_downloaded state after external filesystem changes.

Related errors


AI-assisted analysis of cjpais/Handy@98a4d80cce (2026-08-16). Data as JSON: /api/errors/9c624463d3619dd8. Report an issue: GitHub.