cjpais/Handy · error · anyhow::Error

Canary transcription failed: {}

Error message

Canary transcription failed: {}

What it means

CanaryModel::transcribe failed during ONNX inference. Handy sets output_was_translated from settings.translate_to_english and builds TranscribeOptions { language (None when 'auto'), translate, ..default } before the call; a failure is an ONNX Runtime error from transcribe-rs — session run fault, provider failure, degenerate audio, or corrupt Int8 artifacts. The engine remains loaded; only the transcription is lost.

Source

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

                        .map(|r| r.text)
                        .map_err(|e| anyhow::anyhow!("GigaAM transcription failed: {}", e)),
                    LoadedEngine::Canary(canary_engine) => {
                        output_was_translated = settings.translate_to_english;
                        let lang = if validated_language == "auto" {
                            None
                        } else {
                            Some(validated_language.clone())
                        };
                        applied_language_hint = lang.clone();
                        let options = TranscribeOptions {
                            language: lang,
                            translate: settings.translate_to_english,
                            ..Default::default()
                        };
                        canary_engine
                            .transcribe(&audio, &options)
                            .map(|r| r.text)
                            .map_err(|e| anyhow::anyhow!("Canary transcription failed: {}", e))
                    }
                    LoadedEngine::Cohere(cohere_engine) => {
                        let lang = if validated_language == "auto" {
                            None
                        } else {
                            Some(normalize_cjk_language(&validated_language).to_string())
                        };
                        applied_language_hint = lang.clone();
                        let options = TranscribeOptions {
                            language: lang,
                            ..Default::default()
                        };
                        cohere_engine
                            .transcribe(&audio, &options)
                            .map(|r| r.text)
                            .map_err(|e| anyhow::anyhow!("Cohere transcription failed: {}", e))
                    }
                }

View on GitHub (pinned to 98a4d80cce)

Solutions

  1. Retry the recording, ideally with translate-to-English off to isolate the option
  2. Record longer audio so post-VAD input is non-degenerate
  3. Re-download the Canary model if failures are consistent
  4. Free memory/GPU resources and retry
  5. Update Handy for runtime compatibility fixes

Example fix

// before
let r = canary_engine.transcribe(&audio, &options)?; // options.translate may be on

// after — retry without translation if the translated run fails
let r = match canary_engine.transcribe(&audio, &options) {
    Ok(r) => r,
    Err(e) if options.translate => {
        warn!("Canary translate run failed ({}), retrying without translate", e);
        canary_engine.transcribe(&audio, &TranscribeOptions::default())?
    }
    Err(e) => return Err(anyhow::anyhow!("Canary transcription failed: {}", e)),
};
Defensive patterns

Strategy: try-catch

Validate before calling

anyhow::ensure!(audio.len() >= 1600, "audio too short for Canary");
anyhow::ensure!(audio.iter().all(|s| s.is_finite()), "non-finite audio");
// If translate is on, verify the loaded model supports it (model_info runtime capabilities)

Try / catch

match tm.transcribe(audio.clone()) {
    Err(e) if e.to_string().contains("Canary transcription failed") && settings.translate_to_english => {
        set_translate(false); tm.transcribe(audio) // isolate the translate path
    }
    Err(e) if e.to_string().contains("Canary transcription failed") => reDownloadModel_and_retry(&model_id, audio),
    other => other,
}

Prevention

When it happens

Trigger: canary_engine.transcribe(&audio, &options) errors: ORT run failure; audio too short after VAD; translate enabled on a machine/provider that fails mid-decode; corrupted model files; memory exhaustion.

Common situations: Short clips trimmed by VAD; translate-to-English enabled with flaky GPU providers; partial downloads or quarantined artifacts; low RAM/VRAM while multitasking.

Related errors


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