{"record":{"id":"d37d7cd8054658c4","repo":"Zackriya-Solutions/meetily","slug":"failed-to-open-file-for-resume","errorCode":null,"errorMessage":"Failed to open file for resume {}: {}","messagePattern":"Failed to open file for resume (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs","lineNumber":814,"sourceCode":"                        return Err(anyhow!(\"Retry failed for {} with status: {}\", filename, response.status()));\n                    }\n\n                    (response.content_length().unwrap_or(0), false)\n                }\n            } else {\n                // Other errors\n                let mut active = self.active_downloads.write().await;\n                active.remove(model_name);\n                return Err(anyhow!(\"Download failed for {} with status: {}\", filename, response.status()));\n            };\n\n            // Open file for writing (append if resuming, create new if not)\n            let file = if resuming {\n                fs::OpenOptions::new()\n                    .append(true)\n                    .open(&file_path)\n                    .await\n                    .map_err(|e| anyhow!(\"Failed to open file for resume {}: {}\", filename, e))?\n            } else {\n                fs::File::create(&file_path)\n                    .await\n                    .map_err(|e| anyhow!(\"Failed to create file {}: {}\", filename, e))?\n            };\n\n            // Use buffered writer for better I/O performance (8MB buffer)\n            let mut writer = BufWriter::with_capacity(8 * 1024 * 1024, file);\n\n            // Stream download\n            use futures_util::StreamExt;\n            let mut stream = response.bytes_stream();\n            let mut file_downloaded = if resuming { existing_size } else { 0u64 };\n\n            loop {\n                // Check for cancellation before processing chunk\n                {\n                    let cancel_flag = self.cancel_download_flag.read().await;","sourceCodeStart":796,"sourceCodeEnd":832,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs#L796-L832","documentation":"Returned by download_model_detailed when the server confirmed resume (206 Partial Content) but fs::OpenOptions::append(true).open(&file_path) fails on the existing partial file. The partial file was verified to exist moments earlier (its size drove the Range header), so this is a handle/permission problem on that file rather than a missing file in the common case.","triggerScenarios":"AV or a sync client locked the partial .onnx between the size check and the open; the models directory or file permissions changed (read-only) while downloading; the partial file was deleted by another process between the stat and the open (then 'not found' surfaces here); OS-level handle exhaustion.","commonSituations":"Resuming a download on Windows with real-time AV scanning the large partial file; OneDrive/Dropbox syncing AppData; user manually cleaning the models folder while a resume is in flight.","solutions":["Retry the download after a short wait - transient locks usually clear and the partial file is still there","If it persists, delete the partial file inside the model directory manually (open_parakeet_models_folder shows it) so the next attempt starts that file fresh instead of resuming","Exclude the models directory from AV/sync tools","Verify the models directory is writable by the app user"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// If resume keeps failing on a locked partial file, delete the partials so the\n// next attempt starts that file fresh instead of resuming\nlet dir = engine.get_models_directory().await.join(name);\nif dir.exists() {\n    let _ = tokio::fs::remove_dir_all(&dir).await; // engine re-creates and re-downloads\n}","typeGuard":null,"tryCatchPattern":"match engine.download_model(name, None).await {\n    Err(e) if e.to_string().contains(\"Failed to open file for resume\") => {\n        // wait for AV/sync handles to release, then retry; if it repeats,\n        // delete the partial file (or whole model dir) so no resume open is attempted\n        tokio::time::sleep(std::time::Duration::from_secs(5)).await;\n        engine.download_model(name, None).await\n    }\n    other => other,\n}","preventionTips":["Exclude the models directory from AV and cloud-sync so partial files stay unlockable","Do not clean the models folder manually while a resume is in flight","If a specific partial file always fails to open, remove it once and let the download restart that file"],"tags":["parakeet","filesystem","download","resume","file-locked"],"backgroundTag":"file-open-failed","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}