{"record":{"id":"043e5ad8eea926ff","repo":"cjpais/Handy","slug":"failed-to-load-canary-model","errorCode":null,"errorMessage":"Failed to load canary model {}: {}","messagePattern":"Failed to load canary model (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/transcription.rs","lineNumber":670,"sourceCode":"                            format!(\"Failed to load SenseVoice model {}: {}\", model_id, e);\n                        emit_loading_failed(&error_msg);\n                        anyhow::anyhow!(error_msg)\n                    })?;\n                LoadedEngine::SenseVoice(engine)\n            }\n            EngineType::GigaAM => {\n                let engine = GigaAMModel::load(&model_path, &Quantization::Int8).map_err(|e| {\n                    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        }","sourceCodeStart":652,"sourceCodeEnd":688,"githubUrl":"https://github.com/cjpais/Handy/blob/98a4d80cce8ad41efec2a419b59d9e81229a35d7/src-tauri/src/managers/transcription.rs#L652-L688","documentation":"Thrown when CanaryModel::load cannot create the Int8 Canary ONNX session from the files at model_path. transcribe-rs returns an error when the artifacts are missing/corrupt or ONNX Runtime session creation fails; Handy wraps it with the model_id, notifies the frontend via the loading_failed model-state-changed event, and fails load_model. No engine remains loaded after this error.","triggerScenarios":"load_model() reaches EngineType::Canary and CanaryModel::load(&model_path, &Quantization::Int8) returns Err — e.g. incomplete Canary download, deleted/moved .onnx files, ort execution-provider failure, or memory exhaustion during session init.","commonSituations":"Partial first download or failed upgrade download; manual tampering with the models directory; AV quarantine; transcribe-rs/ort version mismatch after updating the app; low-memory conditions on the target machine.","solutions":["Re-download Canary from the model selector after removing the broken local copy","Inspect the model directory: expected .onnx files present and non-zero size","Free disk space / restore quarantined files, then retry","Load a Whisper model to confirm the ONNX runtime works at all","Keep Handy updated so model artifacts and runtime stay compatible"],"exampleFix":"// before\nlet engine = CanaryModel::load(&model_path, &Quantization::Int8);\n\n// after — distinguish \"files bad\" (re-download) from \"runtime bad\" (report)\nlet engine = match CanaryModel::load(&model_path, &Quantization::Int8) {\n    Ok(e) => e,\n    Err(e) if model_files_look_incomplete(&model_path) => {\n        return Err(anyhow::anyhow!(\"Canary artifacts incomplete — re-download model {}: {}\", model_id, e));\n    }\n    Err(e) => return Err(anyhow::anyhow!(\"Canary load failed (runtime issue): {}\", e)),\n};","handlingStrategy":"validation","validationCode":"// Pre-check Canary artifacts before load\nlet path = model_manager.get_model_path(model_id)?;\nfor entry in std::fs::read_dir(&path)?.filter_map(|e| e.ok()) {\n    anyhow::ensure!(entry.metadata()?.len() > 0, \"empty file: {}\", entry.path().display());\n}","typeGuard":null,"tryCatchPattern":"match tm.load_model(&model_id) {\n    Err(e) if e.to_string().contains(\"Failed to load canary model\") => {\n        model_manager.remove_local_model(&model_id)?;\n        tm.load_model(&model_id)?\n    }\n    other => other?,\n}","preventionTips":["Finish downloads fully; avoid quitting the app mid-fetch","Restore files quarantined by security software or add an exclusion for the models dir","Re-download Canary after Handy updates if it suddenly fails to load","Keep at least one verified-working engine configured as fallback"],"tags":["rust","tauri","onnx","model-loading","canary","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"}