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 load the Cohere ONNX model (Int8 quantization) from model_path. The error message embeds the model_id and the chained ONNX Runtime error, and a "loading_failed" model-state event is emitted before load_model returns the anyhow error.

Solutions

  1. Re-download the Cohere model
  2. Validate the model directory files exist and are non-trivial in size
  3. Address the chained ONNX Runtime error (provider/accelerator switch to CPU)
  4. Check logs from ModelManager for the original download result
Defensive patterns

Strategy: try-catch

Try / catch

match manager.load_model(&model_id, None) {
    Ok(()) => {}
    Err(e) => { /* re-download, single retry, then suggest another engine */ }
}

Prevention

When it happens

Trigger: EngineType::Cohere branch calls CohereModel::load(&model_path, &Quantization::Int8) and it errors: corrupt/incomplete model files, missing Int8 variant, or ONNX Runtime execution provider failure.

Common situations: Download cut short by sleep/network loss; models directory moved or cleaned; onnxruntime version incompatible with the model opset after an app update.

Related errors


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

Appendix: source

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

                    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 ba10ce1943)