Zackriya-Solutions/meetily · error · anyhow::Error

Failed to read {} after download: {}

Error message

Failed to read {} after download: {}

What it means

After a model artifact download completes, the engine calls fs::metadata(&file_path) to verify the stored file size. If the metadata read fails (the file is missing or unreadable), it wraps that OS error with this message. It is a post-download integrity check: the engine expected a fully written artifact on disk but could not even stat it.

Source

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

                    self.set_downloading_status(model_name, progress.percent).await;
                    last_percent = progress.percent;
                    last_report = Instant::now();
                    bytes_since_report = 0;
                }
            }

            writer
                .flush()
                .await
                .map_err(|error| anyhow!("Failed to flush {}: {}", artifact.filename, error))?;
            drop(writer);

            if active_download.cancellation.is_cancelled() {
                return Err(DownloadCancelled.into());
            }
            let stored_bytes = fs::metadata(&file_path)
                .await
                .map_err(|error| anyhow!("Failed to read {} after download: {}", artifact.filename, error))?
                .len();
            if stored_bytes != artifact.exact_bytes {
                return Err(anyhow!(
                    "{} stored {} bytes, expected exactly {} bytes",
                    artifact.filename,
                    stored_bytes,
                    artifact.exact_bytes
                ));
            }
        }

        if confirmed_bytes != total_bytes {
            return Err(anyhow!(
                "Download confirmed {} bytes, expected {} bytes",
                confirmed_bytes,
                total_bytes
            ));
        }

View on GitHub (pinned to a2cb62e827)

Solutions

  1. Re-trigger the download to regenerate the artifact cleanly (delete the partial/stale file first).
  2. Check that the models directory exists and the process has read permission on the artifact path (ls -l / stat the file).
  3. Rule out antivirus or cleanup software deleting files in the model storage directory; add an exclusion for it.
  4. Ensure no concurrent cancel_download call races the download completion; wait for the download to fully finish before cancelling.

Example fix

// before
let stored_bytes = fs::metadata(&file_path)
    .await
    .map_err(|error| anyhow!("Failed to read {} after download: {}", artifact.filename, error))?;
// after (retry metadata read once before failing)
let stored_bytes = match fs::metadata(&file_path).await {
    Ok(m) => m.len(),
    Err(_) => {
        tokio::time::sleep(std::time::Duration::from_millis(100)).await;
        fs::metadata(&file_path)
            .await
            .map_err(|error| anyhow!("Failed to read {} after download: {}", artifact.filename, error))?
            .len()
    }
};
Defensive patterns

Strategy: try-catch

Validate before calling

// Rust: pre-check artifact path exists before/after download
if !tokio::fs::try_exists(&file_path).await.unwrap_or(false) {
    eprintln!("artifact missing, will need re-download: {:?}", file_path);
}

Type guard

// Rust: narrow the metadata result before using len()
fn stored_len(meta: io::Result<std::fs::Metadata>) -> Option<u64> {
    meta.ok().map(|m| m.len())
}

Try / catch

// Rust
match fs::metadata(&file_path).await {
    Ok(meta) => verify_size(meta.len()),
    Err(e) => {
        // treat as corrupt/missing: clean up and retry download once
        let _ = fs::remove_file(&file_path).await;
        retry_download(artifact).await
    }
}

Prevention

When it happens

Trigger: In the Parakeet download flow, after the download future resolves, fs::metadata(&file_path).await returns Err — typically because the file was deleted between download completion and verification, the path is wrong, a concurrent cancel/cleanup removed it, or filesystem permission issues prevent stat on the artifact.

Common situations: Antivirus/OS quarantining or deleting a freshly downloaded model file; the download worker's cleanup racing with verification after a cancellation; a corrupted partial file removed by a prior crashed run leaving a stale path; disk that was remounted or permissions changed mid-download.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@a2cb62e827 (2026-09-12). Data as JSON: /api/errors/67b8781e5b839818. Report an issue: GitHub.