{"record":{"id":"731de7f21836a32e","repo":"cjpais/Handy","slug":"moonshine-streaming-transcription-failed","errorCode":null,"errorMessage":"Moonshine streaming transcription failed: {}","messagePattern":"Moonshine streaming transcription failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/transcription.rs","lineNumber":1347,"sourceCode":"                    LoadedEngine::Parakeet(parakeet_engine) => {\n                        let params = ParakeetParams {\n                            timestamp_granularity: Some(TimestampGranularity::Segment),\n                            ..Default::default()\n                        };\n                        parakeet_engine\n                            .transcribe_with(&audio, &params)\n                            .map(|r| r.text)\n                            .map_err(|e| anyhow::anyhow!(\"Parakeet transcription failed: {}\", e))\n                    }\n                    LoadedEngine::Moonshine(moonshine_engine) => moonshine_engine\n                        .transcribe(&audio, &TranscribeOptions::default())\n                        .map(|r| r.text)\n                        .map_err(|e| anyhow::anyhow!(\"Moonshine transcription failed: {}\", e)),\n                    LoadedEngine::MoonshineStreaming(streaming_engine) => streaming_engine\n                        .transcribe(&audio, &TranscribeOptions::default())\n                        .map(|r| r.text)\n                        .map_err(|e| {\n                            anyhow::anyhow!(\"Moonshine streaming transcription failed: {}\", e)\n                        }),\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)","sourceCodeStart":1329,"sourceCodeEnd":1365,"githubUrl":"https://github.com/cjpais/Handy/blob/98a4d80cce8ad41efec2a419b59d9e81229a35d7/src-tauri/src/managers/transcription.rs#L1329-L1365","documentation":"The streaming Moonshine engine failed in the batch transcribe() path (StreamingModel::transcribe with default options). Although built for live streaming, the engine is also used for whole-clip transcription; failure is an ONNX Runtime error from transcribe-rs such as session run failure, provider fault, degenerate input length, or damaged artifacts. The engine remains loaded — return_engine puts it back after the error.","triggerScenarios":"streaming_engine.transcribe(&audio, &TranscribeOptions::default()) errors: audio too short/degenerate after VAD, ORT session run failure, GPU execution-provider drop, corrupt streaming model files, or memory exhaustion mid-decode.","commonSituations":"Very short post-VAD clips fed to the streaming model; interrupted downloads of the streaming pack; provider/ort mismatches after app updates; concurrent GPU workloads.","solutions":["Retry the recording; transient ORT faults usually clear","Ensure recordings are long enough that VAD leaves usable audio","Re-download the moonshine streaming model if failures are consistent","Reduce memory pressure (close apps, pick a smaller model)","Update Handy for runtime compatibility fixes"],"exampleFix":"// before\nlet r = streaming_engine.transcribe(&audio, &TranscribeOptions::default())?;\n\n// after — treat stream-model batch failure as retriable, fall back to batch engine on repeat failure\nlet r = match streaming_engine.transcribe(&audio, &TranscribeOptions::default()) {\n    Ok(r) => r,\n    Err(e) => {\n        warn!(\"streaming engine batch transcribe failed ({}), retrying once\", e);\n        streaming_engine.transcribe(&audio, &TranscribeOptions::default())\n            .map_err(|e| anyhow::anyhow!(\"Moonshine streaming transcription failed: {}\", e))?\n    }\n};","handlingStrategy":"try-catch","validationCode":"// Same guards as batch engines: non-degenerate, finite audio\nanyhow::ensure!(audio.len() >= 1600, \"audio too short for streaming engine batch use\");\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(\"Moonshine streaming transcription failed\") => {\n        tm.transcribe(audio) // one retry; ORT faults are frequently transient\n    }\n    other => other,\n}","preventionTips":["Prefer finalize_stream() for live sessions; use the streaming engine's batch path only as intended by the app","Keep the streaming model pack complete and re-download on corruption","Monitor memory pressure when mixing streaming and batch workloads","Update Handy for streaming-engine fixes"],"tags":["rust","onnx","moonshine","streaming","inference","transcribe-rs"],"backgroundTag":"onnx-inference-failed","analyzedSha":"98a4d80cce8ad41efec2a419b59d9e81229a35d7","analyzedAt":"2026-08-16T20:58:09.966Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}