{"record":{"id":"b4c14bbb097145ce","repo":"cjpais/Handy","slug":"sensevoice-transcription-failed","errorCode":null,"errorMessage":"SenseVoice transcription failed: {}","messagePattern":"SenseVoice transcription failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/transcription.rs","lineNumber":1366,"sourceCode":"                        }),\n                    LoadedEngine::SenseVoice(sense_voice_engine) => {\n                        let language = match normalize_cjk_language(&validated_language) {\n                            \"zh\" => Some(\"zh\".to_string()),\n                            \"en\" => Some(\"en\".to_string()),\n                            \"ja\" => Some(\"ja\".to_string()),\n                            \"ko\" => Some(\"ko\".to_string()),\n                            \"yue\" => Some(\"yue\".to_string()),\n                            _ => None,\n                        };\n                        applied_language_hint = language.clone();\n                        let params = SenseVoiceParams {\n                            language,\n                            use_itn: Some(true),\n                        };\n                        sense_voice_engine\n                            .transcribe_with(&audio, &params)\n                            .map(|r| r.text)\n                            .map_err(|e| anyhow::anyhow!(\"SenseVoice transcription failed: {}\", e))\n                    }\n                    LoadedEngine::GigaAM(gigaam_engine) => gigaam_engine\n                        .transcribe(&audio, &TranscribeOptions::default())\n                        .map(|r| r.text)\n                        .map_err(|e| anyhow::anyhow!(\"GigaAM transcription failed: {}\", e)),\n                    LoadedEngine::Canary(canary_engine) => {\n                        output_was_translated = settings.translate_to_english;\n                        let lang = if validated_language == \"auto\" {\n                            None\n                        } else {\n                            Some(validated_language.clone())\n                        };\n                        applied_language_hint = lang.clone();\n                        let options = TranscribeOptions {\n                            language: lang,\n                            translate: settings.translate_to_english,\n                            ..Default::default()\n                        };","sourceCodeStart":1348,"sourceCodeEnd":1384,"githubUrl":"https://github.com/cjpais/Handy/blob/98a4d80cce8ad41efec2a419b59d9e81229a35d7/src-tauri/src/managers/transcription.rs#L1348-L1384","documentation":"SenseVoiceModel::transcribe_with failed during ONNX inference. Handy builds SenseVoiceParams { language (zh/en/ja/ko/yue or None from normalize_cjk_language), use_itn: true } and the transcribe-rs call returns an ONNX Runtime error: session run failure, provider fault, unsupported language tensor, degenerate audio length, or corrupted Int8 artifacts. The engine stays loaded after the error (return_engine runs on the normal-error path).","triggerScenarios":"sense_voice_engine.transcribe_with(&audio, &params) errors: ORT session run failure; audio too short after VAD; GPU execution-provider failure; corrupted/missing Int8 model files; memory exhaustion.","commonSituations":"Short recordings trimmed to near-nothing by VAD; AV quarantine or partial download of the SenseVoice pack; provider DLL/so issues after update; multilingual selections (the zh/en/ja/ko/yue mapping) combined with a model build lacking the language head.","solutions":["Retry with a longer, clean recording","Re-download the SenseVoice model if failures repeat","Free memory/VRAM and close competing GPU apps","Test with language set to auto to rule out language-head issues","Update Handy for ort/transcribe-rs compatibility"],"exampleFix":"// before\nsense_voice_engine.transcribe_with(&audio, &params).map_err(|e| anyhow::anyhow!(\"SenseVoice transcription failed: {}\", e))?;\n\n// after — retry once without language hint if the hinted run fails (rules out language-head issues)\nlet r = match sense_voice_engine.transcribe_with(&audio, &params) {\n    Ok(r) => r,\n    Err(e) if params.language.is_some() => {\n        warn!(\"SenseVoice failed with language hint ({}), retrying auto\", e);\n        sense_voice_engine.transcribe_with(&audio, &SenseVoiceParams::default())?\n    }\n    Err(e) => return Err(anyhow::anyhow!(\"SenseVoice transcription failed: {}\", e)),\n};","handlingStrategy":"try-catch","validationCode":"// Validate audio length and finiteness; note language is limited to zh/en/ja/ko/yue or auto\nanyhow::ensure!(audio.len() >= 1600, \"audio too short for SenseVoice\");\nanyhow::ensure!(audio.iter().all(|s| s.is_finite()), \"non-finite audio\");","typeGuard":null,"tryCatchPattern":"match tm.transcribe(audio.clone()) {\n    Err(e) if e.to_string().contains(\"SenseVoice transcription failed\") && language != \"auto\" => {\n        set_language(\"auto\"); tm.transcribe(audio) // drop the hint and retry\n    }\n    Err(e) if e.to_string().contains(\"SenseVoice transcription failed\") => reDownloadModel_and_retry(&model_id, audio),\n    other => other,\n}","preventionTips":["Record at least ~1s of speech so VAD leaves usable audio","Stick to SenseVoice's supported languages (zh, en, ja, ko, yue) or auto","Re-download the Int8 pack after any interrupted fetch","Keep memory headroom for ITN-enabled decode"],"tags":["rust","onnx","sensevoice","inference","transcribe-rs","language"],"backgroundTag":"onnx-inference-failed","analyzedSha":"98a4d80cce8ad41efec2a419b59d9e81229a35d7","analyzedAt":"2026-08-16T20:58:09.966Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}