cjpais/Handy · error · anyhow::Error

Moonshine streaming transcription failed: {}

Error message

Moonshine streaming transcription failed: {}

What it means

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.

Source

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

                    LoadedEngine::Parakeet(parakeet_engine) => {
                        let params = ParakeetParams {
                            timestamp_granularity: Some(TimestampGranularity::Segment),
                            ..Default::default()
                        };
                        parakeet_engine
                            .transcribe_with(&audio, &params)
                            .map(|r| r.text)
                            .map_err(|e| anyhow::anyhow!("Parakeet transcription failed: {}", e))
                    }
                    LoadedEngine::Moonshine(moonshine_engine) => moonshine_engine
                        .transcribe(&audio, &TranscribeOptions::default())
                        .map(|r| r.text)
                        .map_err(|e| anyhow::anyhow!("Moonshine transcription failed: {}", e)),
                    LoadedEngine::MoonshineStreaming(streaming_engine) => streaming_engine
                        .transcribe(&audio, &TranscribeOptions::default())
                        .map(|r| r.text)
                        .map_err(|e| {
                            anyhow::anyhow!("Moonshine streaming transcription failed: {}", e)
                        }),
                    LoadedEngine::SenseVoice(sense_voice_engine) => {
                        let language = match normalize_cjk_language(&validated_language) {
                            "zh" => Some("zh".to_string()),
                            "en" => Some("en".to_string()),
                            "ja" => Some("ja".to_string()),
                            "ko" => Some("ko".to_string()),
                            "yue" => Some("yue".to_string()),
                            _ => None,
                        };
                        applied_language_hint = language.clone();
                        let params = SenseVoiceParams {
                            language,
                            use_itn: Some(true),
                        };
                        sense_voice_engine
                            .transcribe_with(&audio, &params)
                            .map(|r| r.text)

View on GitHub (pinned to 98a4d80cce)

Solutions

  1. Retry the recording; transient ORT faults usually clear
  2. Ensure recordings are long enough that VAD leaves usable audio
  3. Re-download the moonshine streaming model if failures are consistent
  4. Reduce memory pressure (close apps, pick a smaller model)
  5. Update Handy for runtime compatibility fixes

Example fix

// before
let r = streaming_engine.transcribe(&audio, &TranscribeOptions::default())?;

// after — treat stream-model batch failure as retriable, fall back to batch engine on repeat failure
let r = match streaming_engine.transcribe(&audio, &TranscribeOptions::default()) {
    Ok(r) => r,
    Err(e) => {
        warn!("streaming engine batch transcribe failed ({}), retrying once", e);
        streaming_engine.transcribe(&audio, &TranscribeOptions::default())
            .map_err(|e| anyhow::anyhow!("Moonshine streaming transcription failed: {}", e))?
    }
};
Defensive patterns

Strategy: try-catch

Validate before calling

// Same guards as batch engines: non-degenerate, finite audio
anyhow::ensure!(audio.len() >= 1600, "audio too short for streaming engine batch use");
anyhow::ensure!(audio.iter().all(|s| s.is_finite()), "non-finite audio");

Try / catch

match tm.transcribe(audio.clone()) {
    Err(e) if e.to_string().contains("Moonshine streaming transcription failed") => {
        tm.transcribe(audio) // one retry; ORT faults are frequently transient
    }
    other => other,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of cjpais/Handy@98a4d80cce (2026-08-16). Data as JSON: /api/errors/731de7f21836a32e. Report an issue: GitHub.