cjpais/Handy · error · anyhow::Error
Failed to load moonshine model
Error message
Failed to load moonshine model {}: {} What it means
Thrown when MoonshineModel::load from transcribe-rs fails to instantiate the Moonshine Base ONNX model from the files at model_path. The underlying ONNX Runtime error is appended after the model_id. Before returning, the code emits a `model-state-changed` event with event_type "loading_failed" so the frontend can show the failure.
Solutions
- Delete and re-download the model from the model selector (most load failures are corrupt/incomplete downloads)
- Verify the model directory exists and file sizes match what ModelManager recorded for the model
- Check free disk space and filesystem permissions on the app-data models path
- Read the chained ONNX Runtime error after the colon in the log line to identify provider/session issues
- If the error mentions the execution provider, switch the ONNX accelerator setting to CPU and retry, or try a different engine's model
Example fix
// before: load directly, fail on corrupt download
let engine = MoonshineModel::load(&model_path, MoonshineVariant::Base, &Quantization::default())?;
// after: verify the download is complete before loading
if !model_path.exists() || std::fs::read_dir(&model_path)?.next().is_none() {
model_manager.delete_model(&model_id)?;
model_manager.download_model(&model_id).await?;
}
let engine = MoonshineModel::load(&model_path, MoonshineVariant::Base, &Quantization::default())?; Defensive patterns
Strategy: try-catch
Validate before calling
// before load_model: confirm the model files are present and non-empty
use std::fs;
fn model_files_intact(model_path: &std::path::Path) -> bool {
match fs::read_dir(model_path) {
Ok(mut entries) => entries.next().map_or(false, |e| {
e.and_then(|e| fs::metadata(e.path()).map(|m| m.len() > 0)).unwrap_or(false)
}),
Err(_) => false,
}
} Try / catch
match manager.load_model(&model_id, None) {
Ok(()) => { /* proceed; frontend already got load-completed event */ }
Err(e) => {
// a `loading_failed` model-state event was already emitted with the same text
log::error!("model load failed: {e:#}");
model_manager.delete_model(&model_id).ok();
// schedule re-download, then retry load_model once
}
} Prevention
- Never kill the app mid-download; let ModelManager finish writing model files
- Do not manually delete or move files under the app-data models directory
- Subscribe to model-state-changed events and block recording UI while a load is failing
- Keep the onnxruntime runtime libraries bundled with the app; do not swap system copies
When it happens
Trigger: TranscriptionManager::load_model runs with EngineType::Moonshine and MoonshineModel::load(&model_path, MoonshineVariant::Base, &Quantization::default()) errors: model directory missing, .onnx file truncated/partially downloaded, wrong file layout for the expected variant, or ONNX Runtime cannot create a session (missing/incompatible execution provider libraries).
Common situations: Interrupted or disk-full model download leaving a short file; user or cleaner deleted the app-data models directory; app upgrade changed the expected model file layout; onnxruntime dynamic library missing or version-mismatched after an update; antivirus quarantining the .onnx file.
Related errors
- Failed to load moonshine streaming model
- Failed to load canary model
- Failed to load cohere model
- Failed to load gigaam model
- Failed to load SenseVoice model
AI-assisted analysis of cjpais/Handy@ba10ce1943 (2026-08-17).
Data as JSON: /api/errors/973ee9b0474badcf.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/managers/transcription.rs:658
let engine =
ParakeetModel::load(&model_path, &Quantization::Int8).map_err(|e| {
let error_msg =
format!("Failed to load parakeet model {}: {}", model_id, e);
emit_loading_failed(&error_msg);
anyhow::anyhow!(error_msg)
})?;
LoadedEngine::Parakeet(engine)
}
EngineType::Moonshine => {
let engine = MoonshineModel::load(
&model_path,
MoonshineVariant::Base,
&Quantization::default(),
)
.map_err(|e| {
let error_msg = format!("Failed to load moonshine model {}: {}", model_id, e);
emit_loading_failed(&error_msg);
anyhow::anyhow!(error_msg)
})?;
LoadedEngine::Moonshine(engine)
}
EngineType::MoonshineStreaming => {
let engine = StreamingModel::load(&model_path, 0, &Quantization::default())
.map_err(|e| {
let error_msg = format!(
"Failed to load moonshine streaming model {}: {}",
model_id, e
);
emit_loading_failed(&error_msg);
anyhow::anyhow!(error_msg)
})?;
LoadedEngine::MoonshineStreaming(engine)
}
EngineType::SenseVoice => {
let engine =
SenseVoiceModel::load(&model_path, &Quantization::Int8).map_err(|e| {View on GitHub (pinned to ba10ce1943)