astrid-runtime/astrid · error
Distro.toml exceeds 1 MB limit
Error message
Distro.toml exceeds 1 MB limit
What it means
Fetched Distro.toml bytes are size-checked against a 1 MB limit before parsing. The distro manifest must stay small enough to be safely fetched, hashed, and parsed; anything larger is rejected as suspicious or malformed. This guard runs in `parse_manifest_bytes` even when the fetch already applied its own limit.
Source
Thrown at crates/astrid-cli/src/commands/init_signed_source.rs:175
std::fs::read(path).with_context(|| format!("failed to read {}", path.display()))?;
return parse_manifest_bytes(bytes);
}
if offline {
bail!(
"--offline: '{source}' is not a local file and network fetch is forbidden \
(use a Distro.toml path or a .shuttle archive)"
);
}
let url = super::resolve_distro_url(source)?;
eprintln!("Fetching Distro.toml...");
let bytes = fetch_url_bytes(&url, "Distro.toml", 1024 * 1024).await?;
parse_manifest_bytes(bytes)
}
fn parse_manifest_bytes(bytes: Vec<u8>) -> anyhow::Result<(Vec<u8>, DistroManifest)> {
anyhow::ensure!(bytes.len() <= 1024 * 1024, "Distro.toml exceeds 1 MB limit");
let content = std::str::from_utf8(&bytes).context("Distro.toml is not valid UTF-8")?;
let manifest = parse_manifest(content)?;
Ok((bytes, manifest))
}
/// Fetch the signed TOML, its maintainer lock, and existing lock signature.
async fn fetch_signed_manifest(
source: &str,
offline: bool,
accept_new_key: bool,
home: &AstridHome,
) -> anyhow::Result<SignedDistroBundle> {
let source_path = PathBuf::from(source);
let local_manifest_path = source_path
.is_file()
.then(|| normalize_authenticated_manifest_path(&source_path))
.transpose()?;
let source = local_manifest_pathView on GitHub (pinned to affd8760f4)
Solutions
- Verify the source URL/file actually serves the Distro.toml (small valid TOML), not an error page or wrong artifact
- Check the distro source configuration (URL or local path) for typos
- Inspect the served content size with curl/ls and fix the upstream artifact
- If you genuinely need a larger manifest, restructure it (split into lock/members) rather than raising the limit
Example fix
# before source = "https://mirror.example/distro" # serves 3 MB HTML page # after source = "https://distro.example/latest" # serves valid Distro.toml < 1 MB
Defensive patterns
Strategy: try-catch
Validate before calling
fn manifest_bytes_ok(bytes: &[u8]) -> bool { bytes.len() <= 1024 * 1024 }
// check before invoking the fetch/parse path Try / catch
match res {
Err(e) if e.to_string().contains("exceeds 1 MB limit") => verify_source_artifact(),
other => other,
} Prevention
- Verify the source URL serves the real Distro.toml, not error pages
- Check artifact sizes upstream before publishing
- Keep manifests small; move bulk data into lock members
- Add a pre-flight size check in CI for published manifests
When it happens
Trigger: `parse_manifest_bytes` is called with bytes longer than 1,048,576 (fetch_url_bytes with cap 1024*1024, or direct invocation with oversized bytes), so `ensure!(bytes.len() <= 1024 * 1024)` fails.
Common situations: Pointing the distro source at the wrong (very large) file served as Distro.toml; a proxy/mirror returning an HTML error page or huge body; corrupt URL handler streaming beyond the cap.
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
- Distro.lock exceeds 1 MB limit
- Distro.sig exceeds size limit
- --retain-entries must be at least 1
- --retain-bytes must be greater than 0
- --var has an empty key (got {item:?})
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/cd2e6db06bbb450c.
Report an issue: GitHub.