{"record":{"id":"980c4cec0e849ca1","repo":"astrid-runtime/astrid","slug":"label-exceeds-limit-byte-limit","errorCode":null,"errorMessage":"{label} exceeds {limit} byte limit","messagePattern":"(.+?) exceeds (.+?) byte limit","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/self_update/mod.rs","lineNumber":361,"sourceCode":"\n/// Stream a URL into memory under the size cap.\npub(super) async fn download_bounded(\n    client: &reqwest::Client,\n    url: &str,\n    limit: usize,\n    label: &str,\n) -> anyhow::Result<Vec<u8>> {\n    let mut response = client\n        .get(url)\n        .send()\n        .await\n        .map_err(|_| anyhow::anyhow!(\"{label} download failed\"))?;\n    if !response.status().is_success() {\n        bail!(\"{label} download failed: HTTP {}\", response.status());\n    }\n    if let Some(length) = response.content_length() {\n        let length = usize::try_from(length)\n            .map_err(|_| anyhow::anyhow!(\"{label} exceeds {limit} byte limit\"))?;\n        anyhow::ensure!(length <= limit, \"{label} exceeds {limit} byte limit\");\n    }\n    let mut bytes = Vec::new();\n    while let Some(chunk) = response\n        .chunk()\n        .await\n        .map_err(|_| anyhow::anyhow!(\"{label} download failed\"))?\n    {\n        anyhow::ensure!(\n            chunk.len() <= limit.saturating_sub(bytes.len()),\n            \"{label} exceeds {limit} byte limit\"\n        );\n        bytes.extend_from_slice(&chunk);\n    }\n    Ok(bytes)\n}\n\n/// Back up and replace the named binaries from `extract_dir` into `install_dir`.","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/self_update/mod.rs#L343-L379","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// check artifact size before download\nconst head = await fetch(url, { method: \"HEAD\" });\nconst len = Number(head.headers.get(\"content-length\"));\nif (len > LIMIT) throw new Error(`artifact too large: ${len} > ${LIMIT}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["download","self-update","size-limit","supply-chain"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}