astrid-runtime/astrid · error

capsule archive exceeds 50 MB limit

Error message

capsule archive exceeds 50 MB limit

What it means

Raised in download_capsule_asset when the streamed capsule download accumulates more than 50 MB (50 * 1024 * 1024 bytes). The limit is enforced with anyhow::ensure inside the chunk loop to cap memory use and reject oversized or unexpected archives.

Solutions

  1. Pin the capsule to an older release whose archive is under 50 MB
  2. Verify the URL points at the correct capsule archive asset, not a tarball/source
  3. Contact the capsule publisher to shrink or split the archive; the 50 MB limit is a hard client-side cap

Example fix

// before
--from https://github.com/org/repo/releases/latest/download/capsule-huge.bin
// after
--from https://github.com/org/repo/releases/download/v1.2.0/capsule.tar.gz
Defensive patterns

Strategy: validation

Validate before calling

let size = reqwest::head(url).await?.content_length();
if let Some(n) = size {
    if n > 50 * 1024 * 1024 { eprintln!("asset too large ({n} bytes)"); std::process::exit(1); }
}

Try / catch

match resolve_capsule_to_file(...).await { Err(e) if e.to_string().contains("50 MB limit") => { eprintln!("capsule archive too large; pin a smaller release"); Err(e) }, other => other }

Prevention

When it happens

Trigger: Downloading a release asset that is genuinely larger than 50 MB, a mis-pointed URL that returns a huge non-capsule file, or a slow/broken proxy feeding an unbounded stream.

Common situations: Installing a capsule whose latest release asset grew past the limit after a version bump, accidentally targeting a source tarball instead of the capsule archive, or a mirror serving the wrong artifact.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/80b7c897267e44c4. Report an issue: GitHub.

Appendix: source

Thrown at crates/astrid-cli/src/commands/capsule/install.rs:292

// ---------------------------------------------------------------------------
// GitHub installs — release-artifact download with clone-and-build fallback.
// ---------------------------------------------------------------------------

/// Stream a `.capsule` asset to `dest`, enforcing a 50 MB ceiling.
async fn download_capsule_asset(
    client: &reqwest::Client,
    download_url: &str,
    dest: &Path,
) -> anyhow::Result<()> {
    let mut dl = client
        .get(download_url)
        .send()
        .await
        .context("failed to start capsule download")?;
    let mut bytes = Vec::new();
    while let Some(chunk) = dl.chunk().await? {
        bytes.extend_from_slice(&chunk);
        anyhow::ensure!(
            bytes.len() <= 50 * 1024 * 1024,
            "capsule archive exceeds 50 MB limit",
        );
    }
    std::fs::write(dest, &bytes).with_context(|| format!("failed to write {}", dest.display()))?;
    Ok(())
}

/// Install from a GitHub source, returning the concrete ref that was
/// actually resolved and fetched (`Some` on the release-asset path). The
/// clone-and-build fallback returns `None` — there is no single release
/// tag it resolved (it builds from whatever `--depth 1` HEAD it cloned).
async fn install_from_github(
    url: &str,
    name_hint: Option<&str>,
    version: Option<&str>,
    tag: Option<&str>,
    context: InstallContext<'_>,

View on GitHub (pinned to affd8760f4)