{"record":{"id":"c51e33e3b5f824cc","repo":"Zackriya-Solutions/meetily","slug":"download-already-in-progress-for-model","errorCode":null,"errorMessage":"Download already in progress for model: {}","messagePattern":"Download already in progress for model: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs","lineNumber":555,"sourceCode":"                Box::new(move |p: DownloadProgress| cb(p.percent)) as Box<dyn Fn(DownloadProgress) + Send>\n            });\n        self.download_model_detailed(model_name, detailed_callback).await\n    }\n\n    /// Download a Parakeet model with detailed progress (MB/speed/resume support)\n    pub async fn download_model_detailed(\n        &self,\n        model_name: &str,\n        progress_callback: Option<Box<dyn Fn(DownloadProgress) + Send>>,\n    ) -> Result<()> {\n        log::info!(\"Starting download for Parakeet model: {}\", model_name);\n\n        // Check if download is already in progress for this model\n        {\n            let active = self.active_downloads.read().await;\n            if active.contains(model_name) {\n                log::warn!(\"Download already in progress for Parakeet model: {}\", model_name);\n                return Err(anyhow!(\"Download already in progress for model: {}\", model_name));\n            }\n        }\n\n        // Add to active downloads\n        {\n            let mut active = self.active_downloads.write().await;\n            active.insert(model_name.to_string());\n        }\n\n        // Clear any previous cancellation flag for this model\n        {\n            let mut cancel_flag = self.cancel_download_flag.write().await;\n            *cancel_flag = None;\n        }\n\n        // Get model info\n        let model_info = {\n            let models = self.available_models.read().await;","sourceCodeStart":537,"sourceCodeEnd":573,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs#L537-L573","documentation":"Returned by download_model_detailed when model_name is already in the active_downloads set. The engine uses that set as a mutex-like guard (checked read-then-inserted write) so a second concurrent download for the same model is rejected instead of double-writing the same files.","triggerScenarios":"Invoking parakeet_download_model twice for the same model (double-click on the download button, React StrictMode double effect, or two components triggering the same command); a retry fired while the original attempt is still streaming the ~652 MB encoder file.","commonSituations":"No button disabling during download; frontend event listeners re-invoking on progress events; user impatient on a slow link clicking download repeatedly.","solutions":["Treat this error as benign in the UI: the first download is still running - attach to its progress events instead of surfacing an error","Disable the download button while a model is in Downloading status (poll parakeet_get_available_models or track the invoke promise)","Ensure single invocation from React (guard effects with a ref, avoid StrictMode double-calls reaching the command)"],"exampleFix":"// before\nawait invoke('parakeet_download_model', { modelName });\n\n// after - ignore the 'already in progress' guard error\ntry {\n  await invoke('parakeet_download_model', { modelName });\n} catch (e) {\n  if (!String(e).includes('already in progress')) throw e;\n  // first download still running - just resume listening to progress events\n}","handlingStrategy":"validation","validationCode":"// Check for a running download before invoking another\nlet downloading = engine.discover_models().await?\n    .into_iter()\n    .any(|m| m.name == name && matches!(m.status, ModelStatus::Downloading { .. }));\nif downloading {\n    // attach to progress events instead of starting a second download\n}","typeGuard":"// TS: { Downloading: { progress: n } } vs 'Available'/'Missing'\nfunction isDownloading(status: unknown): boolean {\n  return typeof status === 'object' && status !== null && 'Downloading' in status;\n}","tryCatchPattern":"try {\n  await invoke('parakeet_download_model', { modelName });\n} catch (e) {\n  if (String(e).includes('already in progress')) {\n    // not an error: the original download is still running - just show its progress\n  } else {\n    throw e;\n  }\n}","preventionTips":["Disable the download button while the invoke promise is pending","Guard React effects against double invocation (StrictMode) with a ref or status check","Key download state on the model list's Downloading status, not local guesses"],"tags":["parakeet","concurrency","download","tauri"],"backgroundTag":"duplicate-operation","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}