{"record":{"id":"7a09abdd6c2d18e2","repo":"cjpais/Handy","slug":"cohere-transcription-failed","errorCode":null,"errorMessage":"Cohere transcription failed: {}","messagePattern":"Cohere transcription failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/transcription.rs","lineNumber":1404,"sourceCode":"                            .transcribe(&audio, &options)\n                            .map(|r| r.text)\n                            .map_err(|e| anyhow::anyhow!(\"Canary transcription failed: {}\", e))\n                    }\n                    LoadedEngine::Cohere(cohere_engine) => {\n                        let lang = if validated_language == \"auto\" {\n                            None\n                        } else {\n                            Some(normalize_cjk_language(&validated_language).to_string())\n                        };\n                        applied_language_hint = lang.clone();\n                        let options = TranscribeOptions {\n                            language: lang,\n                            ..Default::default()\n                        };\n                        cohere_engine\n                            .transcribe(&audio, &options)\n                            .map(|r| r.text)\n                            .map_err(|e| anyhow::anyhow!(\"Cohere transcription failed: {}\", e))\n                    }\n                }\n            }));\n\n            let text = match transcribe_result {\n                Ok(inner_result) => {\n                    // Success or normal error: return the engine unless a model\n                    // switch/unload invalidated it while it was in use.\n                    self.return_engine(engine, &active_model);\n                    inner_result?\n                }\n                Err(panic_payload) => {\n                    // Engine panicked — do NOT put it back (it's in an unknown state).\n                    // The engine is dropped here, effectively unloading it.\n                    let panic_msg = panic_payload_message(panic_payload.as_ref());\n                    error!(\n                        \"Transcription engine panicked: {}. Model has been unloaded.\",\n                        panic_msg","sourceCodeStart":1386,"sourceCodeEnd":1422,"githubUrl":"https://github.com/cjpais/Handy/blob/98a4d80cce8ad41efec2a419b59d9e81229a35d7/src-tauri/src/managers/transcription.rs#L1386-L1422","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nlet r = cohere_engine.transcribe(&audio, &options)?;\n\n// after — drop the language hint and retry when a hinted run fails\nlet r = match cohere_engine.transcribe(&audio, &options) {\n    Ok(r) => r,\n    Err(e) if options.language.is_some() => {\n        warn!(\"Cohere failed with language hint ({}), retrying auto\", e);\n        cohere_engine.transcribe(&audio, &TranscribeOptions::default())?\n    }\n    Err(e) => return Err(anyhow::anyhow!(\"Cohere transcription failed: {}\", e)),\n};","handlingStrategy":"try-catch","validationCode":"anyhow::ensure!(audio.len() >= 1600, \"audio too short for Cohere\");\nanyhow::ensure!(audio.iter().all(|s| s.is_finite()), \"non-finite audio\");\n// Language is normalized via normalize_cjk_language; 'auto' passes None","typeGuard":null,"tryCatchPattern":"match tm.transcribe(audio.clone()) {\n    Err(e) if e.to_string().contains(\"Cohere transcription failed\") && selected_language != \"auto\" => {\n        set_language(\"auto\"); tm.transcribe(audio)\n    }\n    Err(e) if e.to_string().contains(\"Cohere transcription failed\") => reDownloadModel_and_retry(&model_id, audio),\n    other => other,\n}","preventionTips":["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"],"tags":["rust","onnx","cohere","inference","transcribe-rs","language"],"backgroundTag":"onnx-inference-failed","analyzedSha":"98a4d80cce8ad41efec2a419b59d9e81229a35d7","analyzedAt":"2026-08-16T20:58:09.966Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}