{"record":{"id":"7b0d45606c53dbbe","repo":"Zackriya-Solutions/meetily","slug":"failed-to-delete-incomplete-file","errorCode":null,"errorMessage":"Failed to delete incomplete file {}: {}","messagePattern":"Failed to delete incomplete file (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs","lineNumber":785,"sourceCode":"                // 416: Range not satisfiable - file complete or invalid range\n                log::warn!(\"Server returned 416 Range Not Satisfiable for {}\", filename);\n\n                let size_tolerance = (expected_size as f64 * 0.99) as u64;\n                if existing_size >= size_tolerance && expected_size > 0 {\n                    // File is complete - skip it\n                    log::info!(\"File {} complete ({} bytes). Skipping.\", filename, existing_size);\n                    continue;\n                } else {\n                    // File incomplete but server won't accept range - delete and retry\n                    log::warn!(\n                        \"File {} incomplete ({}/{} bytes). Deleting and retrying.\",\n                        filename, existing_size, expected_size\n                    );\n\n                    if let Err(e) = fs::remove_file(&file_path).await {\n                        let mut active = self.active_downloads.write().await;\n                        active.remove(model_name);\n                        return Err(anyhow!(\"Failed to delete incomplete file {}: {}\", filename, e));\n                    }\n\n                    // Retry without Range header\n                    log::info!(\"Retrying {} without resume\", filename);\n                    response = client.get(&file_url).send().await\n                        .map_err(|e| anyhow!(\"Retry failed for {}: {}\", filename, e))?;\n\n                    if !response.status().is_success() {\n                        let mut active = self.active_downloads.write().await;\n                        active.remove(model_name);\n                        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;","sourceCodeStart":767,"sourceCodeEnd":803,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs#L767-L803","documentation":"Returned by download_model_detailed when a partially downloaded file exists, the server rejected the Range request (non-206 success), and the code tries fs::remove_file on the partial file to restart fresh - but the delete fails. The active_downloads entry is removed before returning, so the failed attempt does not deadlock future downloads.","triggerScenarios":"Antivirus/endpoint protection holds an exclusive handle on the partially written .onnx file; the models directory became read-only between download start and the delete; another process (backup, sync client like OneDrive/Dropbox scanning AppData) locked the file on Windows.","commonSituations":"Corporate AV scanning large binary downloads; cloud-sync tools watching the models folder; resumed download after app crash where the old handle lingers briefly.","solutions":["Retry the download after a few seconds - transient AV/sync locks usually release","Open the models folder via open_parakeet_models_folder and delete the partial file inside the model directory by hand, then retry","Exclude the models directory from AV real-time scanning and cloud sync","Confirm the models directory is writable and not encrypted/controlled by device policy"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Remove partial files yourself when a previous attempt ended in a lock failure\nlet dir = engine.get_models_directory().await.join(name);\nif dir.exists() {\n    for entry in std::fs::read_dir(&dir)? {\n        let p = entry?.path();\n        if p.extension().map_or(false, |e| e == \"onnx\") {\n            let _ = std::fs::remove_file(&p); // ok if it fails; engine retries fresh\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"match engine.download_model(name, None).await {\n    Err(e) if e.to_string().contains(\"Failed to delete incomplete file\") => {\n        // ask the user to close AV/sync locks or delete the partial file by hand, then retry -\n        // the engine removed its active-download entry, so a retry is safe\n        return Err(e);\n    }\n    other => other?,\n}","preventionTips":["Exclude the models directory from real-time antivirus scanning","Keep cloud-sync clients (OneDrive/Dropbox) away from AppData/Application Support","After a crash, let the engine's cleanup path run before retrying manually"],"tags":["parakeet","filesystem","file-locked","download","antivirus"],"backgroundTag":"file-locked","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}