astrid-runtime/astrid · error
exceeds byte limit
Error message
{label} exceeds {limit} byte limit What it means
download_bounded enforces a maximum size (limit) on downloaded artifacts. If the Content-Length header exceeds the limit, or the declared length cannot be represented as usize, it throws this error. This bounds memory usage and is part of the update pipeline's supply-chain hardening.
Solutions
- Verify the artifact's actual size on the release page; it should be within the expected range for that artifact type.
- Check for a proxy that rewrites Content-Length and fetch directly instead.
- Re-run the release workflow to publish correctly sized artifacts.
- If the artifact legitimately needs to be larger, the CLI's limit must be raised by the maintainers — report it.
Defensive patterns
Strategy: validation
Validate before calling
// check artifact size before download
const head = await fetch(url, { method: "HEAD" });
const len = Number(head.headers.get("content-length"));
if (len > LIMIT) throw new Error(`artifact too large: ${len} > ${LIMIT}`); Prevention
- Verify expected artifact sizes on the release page before updating.
- Watch for proxies that inject bogus Content-Length headers.
- Keep publish pipelines from attaching oversized artifacts.
When it happens
Trigger: The server's Content-Length for a release/archive/manifest exceeds the per-artifact byte limit during download_verify_extract, download, fetch_release_by_tag, or resolve_signed_channel. Also when Content-Length overflows usize.
Common situations: A publishing pipeline accidentally attaching a giant artifact; a proxy injecting or mangling Content-Length; pointing ASTRID_UPDATE_REPO at a repo whose assets are larger than the CLI's expected limits.
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
- capsule archive exceeds 50 MB limit
- download failed
- download failed: HTTP
- release asset ' ' has no download URL
- release contains duplicate asset
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/980c4cec0e849ca1.
Report an issue: GitHub.
Appendix: source
Thrown at crates/astrid-cli/src/commands/self_update/mod.rs:361
/// Stream a URL into memory under the size cap.
pub(super) async fn download_bounded(
client: &reqwest::Client,
url: &str,
limit: usize,
label: &str,
) -> anyhow::Result<Vec<u8>> {
let mut response = client
.get(url)
.send()
.await
.map_err(|_| anyhow::anyhow!("{label} download failed"))?;
if !response.status().is_success() {
bail!("{label} download failed: HTTP {}", response.status());
}
if let Some(length) = response.content_length() {
let length = usize::try_from(length)
.map_err(|_| anyhow::anyhow!("{label} exceeds {limit} byte limit"))?;
anyhow::ensure!(length <= limit, "{label} exceeds {limit} byte limit");
}
let mut bytes = Vec::new();
while let Some(chunk) = response
.chunk()
.await
.map_err(|_| anyhow::anyhow!("{label} download failed"))?
{
anyhow::ensure!(
chunk.len() <= limit.saturating_sub(bytes.len()),
"{label} exceeds {limit} byte limit"
);
bytes.extend_from_slice(&chunk);
}
Ok(bytes)
}
/// Back up and replace the named binaries from `extract_dir` into `install_dir`.View on GitHub (pinned to affd8760f4)