{"record":{"id":"bd80dbe3919c708b","repo":"cjpais/Handy","slug":"failed-to-load-cohere-model","errorCode":null,"errorMessage":"Failed to load cohere model {}: {}","messagePattern":"Failed to load cohere model (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/transcription.rs","lineNumber":678,"sourceCode":"                    let error_msg = format!(\"Failed to load gigaam model {}: {}\", model_id, e);\n                    emit_loading_failed(&error_msg);\n                    anyhow::anyhow!(error_msg)\n                })?;\n                LoadedEngine::GigaAM(engine)\n            }\n            EngineType::Canary => {\n                let engine = CanaryModel::load(&model_path, &Quantization::Int8).map_err(|e| {\n                    let error_msg = format!(\"Failed to load canary model {}: {}\", model_id, e);\n                    emit_loading_failed(&error_msg);\n                    anyhow::anyhow!(error_msg)\n                })?;\n                LoadedEngine::Canary(engine)\n            }\n            EngineType::Cohere => {\n                let engine = CohereModel::load(&model_path, &Quantization::Int8).map_err(|e| {\n                    let error_msg = format!(\"Failed to load cohere model {}: {}\", model_id, e);\n                    emit_loading_failed(&error_msg);\n                    anyhow::anyhow!(error_msg)\n                })?;\n                LoadedEngine::Cohere(engine)\n            }\n        };\n\n        // Update the current engine and model ID\n        {\n            let mut engine = self.lock_engine();\n            *engine = Some(loaded_engine);\n        }\n        {\n            let mut current_model = self.current_model_id.lock().unwrap();\n            *current_model = Some(model_id.to_string());\n        }\n\n        // Reset idle timer so the watcher doesn't immediately unload a just-loaded model\n        self.touch_activity();\n","sourceCodeStart":660,"sourceCodeEnd":696,"githubUrl":"https://github.com/cjpais/Handy/blob/98a4d80cce8ad41efec2a419b59d9e81229a35d7/src-tauri/src/managers/transcription.rs#L660-L696","documentation":"Thrown when CohereModel::load fails to build the Int8 Cohere ONNX engine from the artifacts at model_path. Like the other ONNX engines, the error comes from transcribe-rs/ort: missing or truncated .onnx files, artifact/runtime version mismatch, or session-creation failure (provider, memory). Handy formats the model_id and cause, emits loading_failed to the UI, and returns the error from load_model.","triggerScenarios":"load_model() hits EngineType::Cohere and CohereModel::load(&model_path, &Quantization::Int8) errors because the model pack is incomplete, corrupt, or the ort runtime cannot create the session on this machine.","commonSituations":"Interrupted download (network drop, app quit mid-fetch); disk full; antivirus quarantine; Handy update changed the bundled transcribe-rs so older cached Cohere artifacts fail to load; machines with tight memory budgets.","solutions":["Delete and re-download the Cohere model so the artifacts are complete","Validate the model directory files and sizes against the registry before retrying","Check disk space and AV quarantine, then retry","Try a different engine to rule out a general ONNX runtime problem","Update Handy so runtime and artifacts remain version-aligned"],"exampleFix":"// before\nlet engine = CohereModel::load(&model_path, &Quantization::Int8);\n\n// after — verify artifact integrity before handing off to ort\nassert_model_artifacts_present(&model_path, model_id)?; // errors with re-download guidance\nlet engine = CohereModel::load(&model_path, &Quantization::Int8)?;","handlingStrategy":"validation","validationCode":"// Verify Cohere pack integrity before load\nlet path = model_manager.get_model_path(model_id)?;\nlet onnx_count = std::fs::read_dir(&path)?\n    .filter_map(|e| e.ok())\n    .filter(|e| e.path().extension().map_or(false, |x| x == \"onnx\"))\n    .count();\nanyhow::ensure!(onnx_count > 0, \"no .onnx files under {} — re-download Cohere\", path.display());","typeGuard":null,"tryCatchPattern":"match tm.load_model(&model_id) {\n    Err(e) if e.to_string().contains(\"Failed to load cohere model\") => {\n        model_manager.remove_local_model(&model_id)?;\n        tm.load_model(&model_id)?\n    }\n    other => other?,\n}","preventionTips":["Treat any interrupted download as a corrupt pack: delete and re-fetch","Keep the models directory on a disk with stable free space","After app updates, re-download models when load errors mention the ort/session layer","Validate artifacts with the registry size before automating loads"],"tags":["rust","tauri","onnx","model-loading","cohere","transcribe-rs"],"backgroundTag":"onnx-model-load-failed","analyzedSha":"98a4d80cce8ad41efec2a419b59d9e81229a35d7","analyzedAt":"2026-08-16T20:58:09.966Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}