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

{} stored {} bytes, expected exactly {} bytes

Error message

{} stored {} bytes, expected exactly {} bytes

What it means

Per-artifact byte-exact verification. Parakeet artifacts declare an exact_bytes field; after download the engine compares the on-disk size against it and rejects any mismatch. This catches truncated, padded, or corrupted downloads (e.g., HTML error pages written to the file) before the model is registered.

Source

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

                    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
            ));
        }
        let elapsed = download_started.elapsed().as_secs_f64();
        let speed_mbps = if elapsed > 0.0 {
            streamed_bytes as f64 / (1024.0 * 1024.0) / elapsed

View on GitHub (pinned to a2cb62e827)

Solutions

  1. Delete the downloaded artifact and retry the download to rule out a transient network/proxy corruption.
  2. Verify network path: disable proxy/VPN or check captive portal status, then retry.
  3. Compare the served file's actual size against the manifest (curl -sI <url> | grep Content-Length) to see if the server changed the file.
  4. Update the app or model manifest so artifact.exact_bytes matches the current server-side file.

Example fix

// before
if stored_bytes != artifact.exact_bytes {
    return Err(anyhow!("{} stored {} bytes, expected exactly {} bytes", artifact.filename, stored_bytes, artifact.exact_bytes));
}
// after (auto-retry download once on size mismatch)
if stored_bytes != artifact.exact_bytes {
    fs::remove_file(&file_path).await.ok();
    download_once(&artifact, &file_path).await?;
    let stored_bytes = fs::metadata(&file_path).await?.len();
    if stored_bytes != artifact.exact_bytes {
        return Err(anyhow!("{} stored {} bytes, expected exactly {} bytes", artifact.filename, stored_bytes, artifact.exact_bytes));
    }
}
Defensive patterns

Strategy: validation

Validate before calling

// TypeScript/Rust caller side: verify expected size before accepting a downloaded file
const stat = await stat(filePath);
if (stat.size !== artifact.exact_bytes) {
  throw new Error(`size mismatch: got ${stat.size}, want ${artifact.exact_bytes}`);
}

Type guard

// Rust: only treat as valid when sizes match exactly
fn size_matches(meta: &std::fs::Metadata, expected: u64) -> bool {
    meta.len() == expected
}

Try / catch

// Rust
match download_artifact(artifact).await {
    Err(e) if e.to_string().contains("stored") => {
        // size mismatch: purge and retry once
        let _ = fs::remove_file(&file_path).await;
        download_artifact(artifact).await
    }
    other => other,
}

Prevention

When it happens

Trigger: fs::metadata(&file_path).len() != artifact.exact_bytes after the artifact download future resolved successfully — i.e., the transport reported success but the stored file differs in size from the manifest's declared exact size.

Common situations: Proxy or captive portal injecting an HTML login/error page into the download; interrupted-but-resumed download producing a truncated file; CDN serving a stale/partial object; URL changed on the server so the manifest's exact_bytes no longer matches the actual file version.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


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