cjpais/Handy · error · anyhow::Error
Cohere transcription failed: {}
Error message
Cohere transcription failed: {} What it means
CohereModel::transcribe failed during ONNX inference. Handy maps the validated language through normalize_cjk_language and builds TranscribeOptions { language, ..default }; the transcribe-rs call then returns an ONNX Runtime error such as session run failure, provider fault, degenerate input, or damaged artifacts. The engine is returned to the slot on the normal-error path, so it stays loaded.
Source
Thrown at src-tauri/src/managers/transcription.rs:1404
.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_msgView on GitHub (pinned to 98a4d80cce)
Solutions
- Retry the recording to clear transient faults
- Set language to auto and retry to rule out language-head mismatch
- Re-download the Cohere model if failures persist
- Reduce memory/GPU load and retry
- Update Handy for ort/transcribe-rs alignment
Example fix
// before
let r = cohere_engine.transcribe(&audio, &options)?;
// after — drop the language hint and retry when a hinted run fails
let r = match cohere_engine.transcribe(&audio, &options) {
Ok(r) => r,
Err(e) if options.language.is_some() => {
warn!("Cohere failed with language hint ({}), retrying auto", e);
cohere_engine.transcribe(&audio, &TranscribeOptions::default())?
}
Err(e) => return Err(anyhow::anyhow!("Cohere transcription failed: {}", e)),
}; Defensive patterns
Strategy: try-catch
Validate before calling
anyhow::ensure!(audio.len() >= 1600, "audio too short for Cohere"); anyhow::ensure!(audio.iter().all(|s| s.is_finite()), "non-finite audio"); // Language is normalized via normalize_cjk_language; 'auto' passes None
Try / catch
match tm.transcribe(audio.clone()) {
Err(e) if e.to_string().contains("Cohere transcription failed") && selected_language != "auto" => {
set_language("auto"); tm.transcribe(audio)
}
Err(e) if e.to_string().contains("Cohere transcription failed") => reDownloadModel_and_retry(&model_id, audio),
other => other,
} Prevention
- Use auto language while isolating failures; hinted runs exercise more model surface
- Keep clips ≥ ~1s post-VAD
- Re-download the Int8 pack after interrupted downloads
- Update Handy when Cohere support changes land
When it happens
Trigger: cohere_engine.transcribe(&audio, &options) errors: ORT session run failure; audio too short post-VAD; language tensor rejected by the model build; corrupt/missing Int8 artifacts; OOM during inference.
Common situations: Short recordings reduced by VAD; language selection the Cohere build does not carry; partial downloads or AV quarantine; memory pressure; provider/runtime version drift after updates.
Related errors
- SenseVoice transcription failed: {}
- Failed to load cohere model {}: {}
- Parakeet transcription failed: {}
- Moonshine transcription failed: {}
- Moonshine streaming transcription failed: {}
AI-assisted analysis of cjpais/Handy@98a4d80cce (2026-08-16).
Data as JSON: /api/errors/7a09abdd6c2d18e2.
Report an issue: GitHub.