{"record":{"id":"403f957bf542ebff","repo":"cjpais/Handy","slug":"model-is-currently-downloading","errorCode":null,"errorMessage":"Model is currently downloading: {}","messagePattern":"Model is currently downloading: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"src-tauri/src/managers/model.rs","lineNumber":2573,"sourceCode":"        }\n        // Keep the persisted preference here: an already-loaded engine may\n        // still be usable, and re-downloading this model should restore it.\n        // Startup and explicit Rescan perform the broader selection cleanup.\n        let _ = self.app_handle.emit(\"models-updated\", ());\n    }\n\n    pub fn get_model_path(&self, model_id: &str) -> Result<PathBuf> {\n        let model_info = self\n            .get_model_info(model_id)\n            .ok_or_else(|| anyhow::anyhow!(\"Model not found: {}\", model_id))?;\n\n        if !model_info.is_downloaded {\n            return Err(anyhow::anyhow!(\"Model not available: {}\", model_id));\n        }\n\n        // Ensure we don't return partial files/directories\n        if model_info.is_downloading {\n            return Err(anyhow::anyhow!(\n                \"Model is currently downloading: {}\",\n                model_id\n            ));\n        }\n\n        if let ModelSource::HuggingFace { repo_id, revision } = &model_info.source {\n            if let Some(path) = hf_cached_path(repo_id, revision, &model_info.filename) {\n                return Ok(path);\n            }\n            // Mirror-fallback download or manual drop-in in the models dir.\n            // The complete file only ever appears after verification, so a\n            // stale `.partial` alongside it is leftover noise, not a veto —\n            // clear it rather than declaring the model missing.\n            let local_path = self.models_dir.join(&model_info.filename);\n            if local_path.exists() {\n                let partial_path = self\n                    .models_dir\n                    .join(format!(\"{}.partial\", &model_info.filename));","sourceCodeStart":2555,"sourceCodeEnd":2591,"githubUrl":"https://github.com/cjpais/Handy/blob/ba10ce1943ef34e93c09494027fc0b9ced2e8a44/src-tauri/src/managers/model.rs#L2555-L2591","documentation":"get_model_path refuses to return a path while is_downloading is true — a deliberate guard so the transcription pipeline never consumes a partially written file or extracting directory. The flag is set for the whole download/extract lifecycle, so this fires when a model is used mid-download rather than after a failed one.","triggerScenarios":"User starts a recording or switches the active model while a download is in flight; queued transcription resolving the path during extraction; download stuck (see [3]) so the flag stays true for minutes.","commonSituations":"Impatient first-run usage during initial model download; switching from a small to a large model and immediately recording; a stalled download leaving the model in downloading state.","solutions":["Wait for the model-download-complete event before using the model","Disable the model selector / recording UI while any download is active","If the download appears hung, cancel it (cancel_download resets the flag) and retry or pick an already-downloaded model"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// check in-flight state before resolving the path\nlet info = manager.get_model_info(model_id).expect(\"validated earlier\");\nif info.is_downloading {\n    anyhow::bail!(\"Model {model_id} is still downloading — wait for model-download-complete\");\n}","typeGuard":null,"tryCatchPattern":"match manager.get_model_path(id) {\n    Err(e) if e.to_string().contains(\"currently downloading\") => {\n        // wait or cancel: cancel_download resets the flag if the transfer is wedged\n    }\n    other => other,\n}","preventionTips":["Disable model switching and recording start while any download is active","Offer cancel_download when a download appears wedged so the flag can't stay stuck"],"tags":["rust","model","download","race-condition","guard"],"backgroundTag":"resource-not-ready","analyzedSha":"ba10ce1943ef34e93c09494027fc0b9ced2e8a44","analyzedAt":"2026-08-17T10:29:55.597Z","contentChangedAt":"2026-08-17T10:29:55.597Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}