Zackriya-Solutions/meetily · error

Failed to delete incomplete file {}: {}

Error message

Failed to delete incomplete file {}: {}

What it means

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.

Source

Thrown at frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs:785

                // 416: Range not satisfiable - file complete or invalid range
                log::warn!("Server returned 416 Range Not Satisfiable for {}", filename);

                let size_tolerance = (expected_size as f64 * 0.99) as u64;
                if existing_size >= size_tolerance && expected_size > 0 {
                    // File is complete - skip it
                    log::info!("File {} complete ({} bytes). Skipping.", filename, existing_size);
                    continue;
                } else {
                    // File incomplete but server won't accept range - delete and retry
                    log::warn!(
                        "File {} incomplete ({}/{} bytes). Deleting and retrying.",
                        filename, existing_size, expected_size
                    );

                    if let Err(e) = fs::remove_file(&file_path).await {
                        let mut active = self.active_downloads.write().await;
                        active.remove(model_name);
                        return Err(anyhow!("Failed to delete incomplete file {}: {}", filename, e));
                    }

                    // Retry without Range header
                    log::info!("Retrying {} without resume", filename);
                    response = client.get(&file_url).send().await
                        .map_err(|e| anyhow!("Retry failed for {}: {}", filename, e))?;

                    if !response.status().is_success() {
                        let mut active = self.active_downloads.write().await;
                        active.remove(model_name);
                        return Err(anyhow!("Retry failed for {} with status: {}", filename, response.status()));
                    }

                    (response.content_length().unwrap_or(0), false)
                }
            } else {
                // Other errors
                let mut active = self.active_downloads.write().await;

View on GitHub (pinned to 0281737d87)

Solutions

  1. Retry the download after a few seconds - transient AV/sync locks usually release
  2. Open the models folder via open_parakeet_models_folder and delete the partial file inside the model directory by hand, then retry
  3. Exclude the models directory from AV real-time scanning and cloud sync
  4. Confirm the models directory is writable and not encrypted/controlled by device policy
Defensive patterns

Strategy: retry

Validate before calling

// Remove partial files yourself when a previous attempt ended in a lock failure
let dir = engine.get_models_directory().await.join(name);
if dir.exists() {
    for entry in std::fs::read_dir(&dir)? {
        let p = entry?.path();
        if p.extension().map_or(false, |e| e == "onnx") {
            let _ = std::fs::remove_file(&p); // ok if it fails; engine retries fresh
        }
    }
}

Try / catch

match engine.download_model(name, None).await {
    Err(e) if e.to_string().contains("Failed to delete incomplete file") => {
        // ask the user to close AV/sync locks or delete the partial file by hand, then retry -
        // the engine removed its active-download entry, so a retry is safe
        return Err(e);
    }
    other => other?,
}

Prevention

When it happens

Trigger: 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.

Common situations: Corporate AV scanning large binary downloads; cloud-sync tools watching the models folder; resumed download after app crash where the old handle lingers briefly.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16). Data as JSON: /api/errors/7b0d45606c53dbbe. Report an issue: GitHub.