cjpais/Handy · error · anyhow::Error

Failed to load cohere model {}: {}

Error message

Failed to load cohere model {}: {}

What it means

Thrown when CohereModel::load fails to build the Int8 Cohere ONNX engine from the artifacts at model_path. Like the other ONNX engines, the error comes from transcribe-rs/ort: missing or truncated .onnx files, artifact/runtime version mismatch, or session-creation failure (provider, memory). Handy formats the model_id and cause, emits loading_failed to the UI, and returns the error from load_model.

Source

Thrown at src-tauri/src/managers/transcription.rs:678

                    let error_msg = format!("Failed to load gigaam model {}: {}", model_id, e);
                    emit_loading_failed(&error_msg);
                    anyhow::anyhow!(error_msg)
                })?;
                LoadedEngine::GigaAM(engine)
            }
            EngineType::Canary => {
                let engine = CanaryModel::load(&model_path, &Quantization::Int8).map_err(|e| {
                    let error_msg = format!("Failed to load canary model {}: {}", model_id, e);
                    emit_loading_failed(&error_msg);
                    anyhow::anyhow!(error_msg)
                })?;
                LoadedEngine::Canary(engine)
            }
            EngineType::Cohere => {
                let engine = CohereModel::load(&model_path, &Quantization::Int8).map_err(|e| {
                    let error_msg = format!("Failed to load cohere model {}: {}", model_id, e);
                    emit_loading_failed(&error_msg);
                    anyhow::anyhow!(error_msg)
                })?;
                LoadedEngine::Cohere(engine)
            }
        };

        // Update the current engine and model ID
        {
            let mut engine = self.lock_engine();
            *engine = Some(loaded_engine);
        }
        {
            let mut current_model = self.current_model_id.lock().unwrap();
            *current_model = Some(model_id.to_string());
        }

        // Reset idle timer so the watcher doesn't immediately unload a just-loaded model
        self.touch_activity();

View on GitHub (pinned to 98a4d80cce)

Solutions

  1. Delete and re-download the Cohere model so the artifacts are complete
  2. Validate the model directory files and sizes against the registry before retrying
  3. Check disk space and AV quarantine, then retry
  4. Try a different engine to rule out a general ONNX runtime problem
  5. Update Handy so runtime and artifacts remain version-aligned

Example fix

// before
let engine = CohereModel::load(&model_path, &Quantization::Int8);

// after — verify artifact integrity before handing off to ort
assert_model_artifacts_present(&model_path, model_id)?; // errors with re-download guidance
let engine = CohereModel::load(&model_path, &Quantization::Int8)?;
Defensive patterns

Strategy: validation

Validate before calling

// Verify Cohere pack integrity before load
let path = model_manager.get_model_path(model_id)?;
let onnx_count = std::fs::read_dir(&path)?
    .filter_map(|e| e.ok())
    .filter(|e| e.path().extension().map_or(false, |x| x == "onnx"))
    .count();
anyhow::ensure!(onnx_count > 0, "no .onnx files under {} — re-download Cohere", path.display());

Try / catch

match tm.load_model(&model_id) {
    Err(e) if e.to_string().contains("Failed to load cohere model") => {
        model_manager.remove_local_model(&model_id)?;
        tm.load_model(&model_id)?
    }
    other => other?,
}

Prevention

When it happens

Trigger: load_model() hits EngineType::Cohere and CohereModel::load(&model_path, &Quantization::Int8) errors because the model pack is incomplete, corrupt, or the ort runtime cannot create the session on this machine.

Common situations: Interrupted download (network drop, app quit mid-fetch); disk full; antivirus quarantine; Handy update changed the bundled transcribe-rs so older cached Cohere artifacts fail to load; machines with tight memory budgets.

Related errors


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