cjpais/Handy · error · anyhow::Error

Cohere transcription failed

Error message

Cohere transcription failed: {}

What it means

The Cohere branch normalizes the language (normalize_cjk_language) into TranscribeOptions and calls transcribe; this error wraps the ONNX Runtime failure from the Cohere Int8 graph. It is the last engine arm before the match closes and the engine is returned via return_engine.

Solutions

  1. Inspect the chained ORT error; switch accelerator to CPU for provider errors
  2. Retry with longer audio
  3. Re-download the Cohere model
  4. Update the app if ORT/model compatibility changed
Defensive patterns

Strategy: retry

Try / catch

match manager.transcribe(audio.clone()) {
    Err(e) if e.to_string().contains("Cohere transcription failed") => manager.transcribe(audio),
    other => other,
}

Prevention

When it happens

Trigger: cohere_engine.transcribe errors: ORT provider failure, invalid input tensor shape from very short audio, or corrupted Int8 model graph.

Common situations: Driver/GPU instability; near-empty audio after VAD; model files damaged.

Related errors


AI-assisted analysis of cjpais/Handy@ba10ce1943 (2026-08-17). Data as JSON: /api/errors/7a09abdd6c2d18e2. Report an issue: GitHub.

Appendix: source

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

                            .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))
                    }
                }
            }));

            let text = match transcribe_result {
                Ok(inner_result) => {
                    // Success or normal error: return the engine unless a model
                    // switch/unload invalidated it while it was in use.
                    self.return_engine(engine, &active_model);
                    inner_result?
                }
                Err(panic_payload) => {
                    // Engine panicked — do NOT put it back (it's in an unknown state).
                    // The engine is dropped here, effectively unloading it.
                    let panic_msg = panic_payload_message(panic_payload.as_ref());
                    error!(
                        "Transcription engine panicked: {}. Model has been unloaded.",
                        panic_msg

View on GitHub (pinned to ba10ce1943)