cjpais/Handy · error · anyhow::Error
Moonshine transcription failed: {}
Error message
Moonshine transcription failed: {} What it means
MoonshineModel::transcribe failed during ONNX inference with default TranscribeOptions. transcribe-rs surfaces an ONNX Runtime error — session run failure, execution-provider problem, invalid input length (Moonshine has minimum chunk requirements), or damaged model files. Only this call fails; the engine is put back into the slot, so the model stays loaded for the next attempt.
Source
Thrown at src-tauri/src/managers/transcription.rs:1342
})
.map_err(|e| {
anyhow::anyhow!("transcribe-cpp transcription failed: {}", e)
})
}
LoadedEngine::Parakeet(parakeet_engine) => {
let params = ParakeetParams {
timestamp_granularity: Some(TimestampGranularity::Segment),
..Default::default()
};
parakeet_engine
.transcribe_with(&audio, ¶ms)
.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,View on GitHub (pinned to 98a4d80cce)
Solutions
- Retry with a longer recording so the audio meets Moonshine's minimum input length
- Re-download the Moonshine model if every attempt fails
- Free memory / close GPU-heavy applications and retry
- Try another engine to determine whether the fault is Moonshine-specific
- Update Handy for ort/transcribe-rs fixes
Example fix
// before
let r = moonshine_engine.transcribe(&audio, &TranscribeOptions::default())?;
// after — pad short audio to Moonshine's minimum chunk before transcribing
let audio = if audio.len() < MIN_MOONSHINE_SAMPLES { pad_to(audio, MIN_MOONSHINE_SAMPLES) } else { audio };
let r = moonshine_engine.transcribe(&audio, &TranscribeOptions::default())?; Defensive patterns
Strategy: try-catch
Validate before calling
// Moonshine needs a minimum chunk; pad or reject before the engine call const MIN_MOONSHINE_SAMPLES: usize = 16_000; // ~1s @ 16kHz anyhow::ensure!(audio.len() >= MIN_MOONSHINE_SAMPLES || pad_ok, "clip too short for Moonshine");
Try / catch
match tm.transcribe(audio.clone()) {
Err(e) if e.to_string().contains("Moonshine transcription failed") => {
let padded = pad_to_min(audio, MIN_MOONSHINE_SAMPLES);
tm.transcribe(padded)
}
other => other,
} Prevention
- Avoid ultra-short clips; Moonshine has minimum input-length requirements
- Verify the model pack is intact (non-empty .onnx files) before sessions
- Free RAM before long inference batches
- Keep transcribe-rs/ort and model artifacts version-aligned via app updates
When it happens
Trigger: moonshine_engine.transcribe(&audio, &TranscribeOptions::default()) errors: audio shorter than Moonshine's minimum chunk after VAD trimming; OrtError from a failing GPU execution provider; corrupted/missing .onnx artifacts at inference time; OOM during decode.
Common situations: Brief clicks/short utterances reduced to tiny audio by VAD; partial model deletion on disk; ort version/provider mismatch after update; low-memory machines; other GPU processes contending.
Related errors
- Moonshine streaming transcription failed: {}
- Failed to load moonshine model {}: {}
- Failed to load moonshine streaming model {}: {}
- Parakeet transcription failed: {}
- SenseVoice transcription failed: {}
AI-assisted analysis of cjpais/Handy@98a4d80cce (2026-08-16).
Data as JSON: /api/errors/bf05cfe29d082972.
Report an issue: GitHub.