cjpais/Handy · error · anyhow::Error

Complete model directory not found

Error message

Complete model directory not found: {}

What it means

A directory-based model (is_directory, e.g. an extracted archive) is considered incomplete: either the final model directory does not exist / is not a directory, or a .partial marker still exists alongside it. The .partial file is the download/extract in-progress marker, so its presence vetoes the directory even if the directory itself exists.

Solutions

  1. Re-download the model — the pipeline cleans partials and re-extracts
  2. If the directory is actually complete, delete the stray .partial file next to it and retry
  3. Check earlier extraction errors in the log (model-extraction-failed) for the root cause
Defensive patterns

Strategy: fallback

Validate before calling

// for directory models: complete dir present AND no .partial marker
let dir_ok = model_path.is_dir() && !partial_path.exists();
if !dir_ok {
    // stale .partial with an otherwise complete dir: clear the marker
    if model_path.is_dir() && partial_path.exists() {
        let _ = fs::remove_file(&partial_path);
    } else {
        anyhow::bail!("incomplete directory model — re-download");
    }
}

Try / catch

match manager.get_model_path(id) {
    Err(e) if e.to_string().contains("directory not found") => {
        manager.delete_model(id)?;
        manager.download_model(id).await?; // re-extracts cleanly
    }
    other => other?,
}

Prevention

When it happens

Trigger: Extraction interrupted leaving the .partial marker behind; the extracted directory deleted or renamed by the user; extraction failed earlier (see [8]) so final_model_dir was never populated; partial file left over from a crashed download of the archive.

Common situations: App killed mid-extract; users manually cleaning the models dir; disk-full aborting the move from temp to final.

Related errors


AI-assisted analysis of cjpais/Handy@ba10ce1943 (2026-09-17). Data as JSON: /api/errors/da75a47e038d118f. Report an issue: GitHub.

Appendix: source

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

                }
                return Ok(local_path);
            }
            self.mark_model_unavailable(model_id);
            return Err(anyhow::anyhow!(
                "Complete model file not found in HF cache or models dir: {}",
                model_id
            ));
        }

        let model_path = self.models_dir.join(&model_info.filename);
        let partial_path = self
            .models_dir
            .join(format!("{}.partial", &model_info.filename));

        if model_info.is_directory {
            if !model_path.exists() || !model_path.is_dir() {
                self.mark_model_unavailable(model_id);
                return Err(anyhow::anyhow!(
                    "Complete model directory not found: {}",
                    model_id
                ));
            }
            if partial_path.exists() {
                return Err(anyhow::anyhow!(
                    "Model directory is incomplete: {}",
                    model_id
                ));
            }
            Ok(model_path)
        } else {
            if !model_path.exists() {
                self.mark_model_unavailable(model_id);
                return Err(anyhow::anyhow!(
                    "Complete model file not found: {}",
                    model_id
                ));

View on GitHub (pinned to ba10ce1943)