astrid-runtime/astrid · error

Distro.sig exceeds size limit

Error message

Distro.sig exceeds size limit

What it means

The signature member Distro.sig is size-checked against 64 KB. A valid signature blob (hex-encoded signature) is tiny; anything larger cannot be a legitimate signature and is rejected before hex/UTF-8 parsing and signature verification.

Source

Thrown at crates/astrid-cli/src/commands/init_signed_source.rs:208

        .is_file()
        .then(|| normalize_authenticated_manifest_path(&source_path))
        .transpose()?;
    let source = local_manifest_path
        .as_deref()
        .and_then(Path::to_str)
        .map_or_else(|| source.to_owned(), str::to_owned);
    let (manifest_bytes, manifest) = fetch_manifest_bytes(&source, offline).await?;
    let manifest_hash = manifest_hash(&manifest_bytes);
    let lock_bytes = fetch_signed_member(&source, offline, "Distro.lock").await?;
    anyhow::ensure!(
        lock_bytes.len() <= 1024 * 1024,
        "Distro.lock exceeds 1 MB limit"
    );
    let lock_text = std::str::from_utf8(&lock_bytes).context("Distro.lock is not valid UTF-8")?;
    let lock: DistroLock =
        toml::from_str(lock_text).context("failed to parse signed Distro.lock")?;
    let sig_bytes = fetch_signed_member(&source, offline, "Distro.sig").await?;
    anyhow::ensure!(
        sig_bytes.len() <= 64 * 1024,
        "Distro.sig exceeds size limit"
    );
    let sig_hex = std::str::from_utf8(&sig_bytes).context("Distro.sig is not valid UTF-8")?;
    let pinned_refs = verify_signed_manifest(
        home,
        &manifest,
        &manifest_hash,
        &lock,
        sig_hex,
        accept_new_key,
    )?;

    Ok(SignedDistroBundle {
        manifest,
        lock,
        manifest_hash,
        pinned_refs,

View on GitHub (pinned to affd8760f4)

Solutions

  1. Verify the file at the Distro.sig path is the actual hex signature and restore the correct one if overwritten
  2. Re-fetch the signed source (manifest, lock, sig) from the maintainer's official location
  3. Regenerate the signature with the maintainer signing tool if it was corrupted locally
  4. Check the local source directory for accidental large files named Distro.sig

Example fix

# before
$ head -c 100000 Distro.sig   # giant wrong file
# after
$ astrid distro sign > Distro.sig   # regenerate proper signature blob
Defensive patterns

Strategy: try-catch

Validate before calling

fn sig_bytes_ok(bytes: &[u8]) -> bool { bytes.len() <= 64 * 1024 }

Try / catch

match res {
    Err(e) if e.to_string().contains("Distro.sig exceeds size limit") => refetch_or_resign_source(),
    other => other,
}

Prevention

When it happens

Trigger: `fetch_signed_manifest` calls `fetch_signed_member(..., "Distro.sig")` and then `ensure!(sig_bytes.len() <= 64 * 1024, ...)`; bytes over 64 KB raise the error. Occurs when the sig path contains the wrong file or a mirror returns oversized content.

Common situations: Overwriting Distro.sig with a log or binary by mistake; upstream publishing a malformed sig member; confusion between local directory mode and remote fetch mode so the wrong file is read.

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/ebad9f39f571eb49. Report an issue: GitHub.