cjpais/Handy · error · anyhow::Error

Model not available: {}

Error message

Model not available: {}

What it means

get_model_path found the model entry but is_downloaded is false — the model is known (e.g. in the catalog) but its file is not present locally. The subsequent checks (downloading, partial files) never run because this guard returns first.

Source

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

        } else {
            // Update download status (marks predefined models as not downloaded)
            self.update_download_status()?;
            debug!("ModelManager: download status updated");
        }

        // Emit event to notify UI
        let _ = self.app_handle.emit("model-deleted", model_id);

        Ok(())
    }

    pub fn get_model_path(&self, model_id: &str) -> Result<PathBuf> {
        let model_info = self
            .get_model_info(model_id)
            .ok_or_else(|| anyhow::anyhow!("Model not found: {}", model_id))?;

        if !model_info.is_downloaded {
            return Err(anyhow::anyhow!("Model not available: {}", model_id));
        }

        // Ensure we don't return partial files/directories
        if model_info.is_downloading {
            return Err(anyhow::anyhow!(
                "Model is currently downloading: {}",
                model_id
            ));
        }

        if let ModelSource::HuggingFace { repo_id, revision } = &model_info.source {
            if let Some(path) = hf_cached_path(repo_id, revision, &model_info.filename) {
                return Ok(path);
            }
            // Mirror-fallback download or manual drop-in in the models dir.
            // The complete file only ever appears after verification, so a
            // stale `.partial` alongside it is leftover noise, not a veto —
            // clear it rather than declaring the model missing.

View on GitHub (pinned to 98a4d80cce)

Solutions

  1. Download the model first (download_model) and wait for model-download-complete
  2. Trigger a rescan/update_download_status if the file actually exists on disk but state is stale
  3. In the UI, gate the record action on the selected model's is_downloaded flag

Example fix

// before
let path = manager.get_model_path(model_id)?;

// after
if let Some(info) = manager.get_model_info(model_id) {
    if !info.is_downloaded {
        anyhow::bail!("model {model_id} not downloaded — download it first");
    }
}
let path = manager.get_model_path(model_id)?;
Defensive patterns

Strategy: validation

Validate before calling

if let Some(info) = manager.get_model_info(model_id) {
    if !info.is_downloaded {
        anyhow::bail!("model {model_id} is not downloaded — start the download first");
    }
    if info.is_downloading {
        anyhow::bail!("model {model_id} is still downloading");
    }
}
let path = manager.get_model_path(model_id)?;

Try / catch

match manager.get_model_path(model_id) {
    Ok(p) => p,
    Err(e) if e.to_string().contains("Model not available") => {
        // offer download or pick another model instead of failing the recording
        anyhow::bail!("selected model needs downloading before recording")
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Recording started with a catalog model selected before it was downloaded; download interrupted leaving only a .partial; is_downloaded state stale after the file was deleted externally without a rescan.

Common situations: Fresh installs where settings default to a model the user never downloaded; manual deletion of model files from disk; failed downloads leaving the model marked not-downloaded.

Related errors


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