{"record":{"id":"02e23274e196bcfe","repo":"cjpais/Handy","slug":"failed-to-load-sensevoice-model","errorCode":null,"errorMessage":"Failed to load SenseVoice model {}: {}","messagePattern":"Failed to load SenseVoice model (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/transcription.rs","lineNumber":654,"sourceCode":"            EngineType::MoonshineStreaming => {\n                let engine = StreamingModel::load(&model_path, 0, &Quantization::default())\n                    .map_err(|e| {\n                        let error_msg = format!(\n                            \"Failed to load moonshine streaming model {}: {}\",\n                            model_id, e\n                        );\n                        emit_loading_failed(&error_msg);\n                        anyhow::anyhow!(error_msg)\n                    })?;\n                LoadedEngine::MoonshineStreaming(engine)\n            }\n            EngineType::SenseVoice => {\n                let engine =\n                    SenseVoiceModel::load(&model_path, &Quantization::Int8).map_err(|e| {\n                        let error_msg =\n                            format!(\"Failed to load SenseVoice model {}: {}\", model_id, e);\n                        emit_loading_failed(&error_msg);\n                        anyhow::anyhow!(error_msg)\n                    })?;\n                LoadedEngine::SenseVoice(engine)\n            }\n            EngineType::GigaAM => {\n                let engine = GigaAMModel::load(&model_path, &Quantization::Int8).map_err(|e| {\n                    let error_msg = format!(\"Failed to load gigaam model {}: {}\", model_id, e);\n                    emit_loading_failed(&error_msg);\n                    anyhow::anyhow!(error_msg)\n                })?;\n                LoadedEngine::GigaAM(engine)\n            }\n            EngineType::Canary => {\n                let engine = CanaryModel::load(&model_path, &Quantization::Int8).map_err(|e| {\n                    let error_msg = format!(\"Failed to load canary model {}: {}\", model_id, e);\n                    emit_loading_failed(&error_msg);\n                    anyhow::anyhow!(error_msg)\n                })?;\n                LoadedEngine::Canary(engine)","sourceCodeStart":636,"sourceCodeEnd":672,"githubUrl":"https://github.com/cjpais/Handy/blob/98a4d80cce8ad41efec2a419b59d9e81229a35d7/src-tauri/src/managers/transcription.rs#L636-L672","documentation":"Thrown when SenseVoiceModel::load cannot build the Int8-quantized SenseVoice ONNX session from the model files at model_path. transcribe-rs fails when the expected .onnx artifacts are missing/corrupt or ONNX Runtime cannot create the session (provider unavailable, OOM). Handy wraps the cause with the model_id, emits a loading_failed model-state-changed event for the UI, and returns the error from load_model.","triggerScenarios":"load_model() reaches EngineType::SenseVoice and SenseVoiceModel::load(&model_path, &Quantization::Int8) returns Err — missing/truncated Int8 ONNX files in the model directory, hash-mismatched artifacts, or an ort session-creation failure such as a missing execution provider or insufficient memory.","commonSituations":"Interrupted or partial model download; user or cleanup tool deleted files inside the models directory; AV false-positive quarantine of .onnx files; app update changed the ort/transcribe-rs version so previously downloaded SenseVoice artifacts no longer load; constrained-RAM devices.","solutions":["Re-download SenseVoice from the model selector (remove the local copy first so ModelManager fetches fresh files)","Verify the model directory's .onnx files exist and are non-empty (compare against the registry's expected sizes)","Free disk space and check antivirus quarantine, then retry","Load another engine (Whisper/Parakeet) to verify the shared ONNX runtime path works","Update Handy to keep transcribe-rs/ort and downloaded artifacts in sync"],"exampleFix":"// before\nlet engine = SenseVoiceModel::load(&model_path, &Quantization::Int8);\n\n// after — validate before loading and give a re-download hint\nlet artifacts = std::fs::read_dir(&model_path)?.filter_map(|e| e.ok()).collect::<Vec<_>>();\nanyhow::ensure!(!artifacts.is_empty(), \"SenseVoice model dir is empty: {} — re-download the model\", model_path.display());\nlet engine = SenseVoiceModel::load(&model_path, &Quantization::Int8)?;","handlingStrategy":"validation","validationCode":"// Verify SenseVoice Int8 artifacts exist and are non-trivial before load\nlet path = model_manager.get_model_path(model_id)?;\nlet total: u64 = std::fs::read_dir(&path)?\n    .filter_map(|e| e.ok())\n    .map(|e| e.metadata().map(|m| m.len()).unwrap_or(0))\n    .sum();\nanyhow::ensure!(total > 1_000_000, \"SenseVoice artifacts suspiciously small ({} bytes) — re-download\", total);","typeGuard":null,"tryCatchPattern":"match tm.load_model(&model_id) {\n    Err(e) if e.to_string().contains(\"Failed to load SenseVoice model\") => {\n        model_manager.remove_local_model(&model_id)?;\n        tm.initiate_model_load(); // re-download + reload in background\n    }\n    other => { other?; }\n}","preventionTips":["Check the model-state-changed event stream for loading_failed and re-download on first occurrence","Keep enough free disk space (several hundred MB) before adding SenseVoice","Do not manually prune files inside the models directory","Pin to app versions whose model registry matches your downloaded models"],"tags":["rust","tauri","onnx","model-loading","sensevoice","transcribe-rs"],"backgroundTag":"onnx-model-load-failed","analyzedSha":"98a4d80cce8ad41efec2a419b59d9e81229a35d7","analyzedAt":"2026-08-16T20:58:09.966Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}