cjpais/Handy · error · anyhow::Error

Parakeet transcription failed: {}

Error message

Parakeet transcription failed: {}

What it means

ParakeetModel::transcribe_with failed during ONNX inference. The wrapped error is an ONNX Runtime failure from transcribe-rs: session run error, execution-provider failure (GPU EP unavailable/dropped), invalid input shape (audio too short/empty after VAD filtering), or a corrupted model file. The engine is returned to the slot afterwards, so the model remains loaded — only this transcription failed.

Source

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

                            .map(|t| {
                                // Whisper's audio-based LID (auto mode only;
                                // `None` when a language hint was passed).
                                model_detected_language = t.language;
                                t.text
                            })
                            .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, &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()),

View on GitHub (pinned to 98a4d80cce)

Solutions

  1. Retry the recording — transient ORT/provider faults often clear
  2. Record a slightly longer utterance so post-VAD audio is not degenerate
  3. Re-download the Parakeet model if errors persist on every attempt
  4. Check available RAM/VRAM and close competing GPU-heavy apps
  5. Update Handy so the bundled ort matches the model artifacts

Example fix

// before
parakeet_engine.transcribe_with(&audio, &params).map_err(|e| anyhow::anyhow!("Parakeet transcription failed: {}", e))?;

// after — guard degenerate audio, retry once on failure
anyhow::ensure!(audio.len() >= 1600, "audio too short for Parakeet ({} samples)", audio.len()); // ~100ms @16k
let result = match parakeet_engine.transcribe_with(&audio, &params) {
    Ok(r) => r,
    Err(e) => { warn!("parakeet attempt failed ({}), retrying", e); parakeet_engine.transcribe_with(&audio, &params)? }
};
Defensive patterns

Strategy: try-catch

Validate before calling

// Guard degenerate input before calling the engine
anyhow::ensure!(audio.len() >= 1600, "audio too short after VAD ({} samples)", audio.len());
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("Parakeet transcription failed") => {
        if is_transient_ort_error(&e) { tm.transcribe(audio) } else { reDownloadModel_and_retry(&model_id, audio) }
    }
    other => other,
}

Prevention

When it happens

Trigger: parakeet_engine.transcribe_with(&audio, &ParakeetParams { timestamp_granularity: Segment, ..Default }) errors: OrtError on session run, GPU execution provider failing at runtime, audio vector degenerate (near-zero length after VAD), or model artifacts damaged on disk.

Common situations: Very short recordings that VAD reduces to a few ms of audio; ONNX runtime provider DLL/so missing after an app update; model folder partially deleted; GPU drivers flaky; memory pressure from other apps evicting the EP.

Related errors


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