{"record":{"id":"2cf1d28fa18b77ce","repo":"astrid-runtime/astrid","slug":"local-capsule-source-source-is-bytes-excee","errorCode":null,"errorMessage":"local capsule source {source:?} is {} bytes, exceeding the {MAX_MEMBER_BYTES}-byte member limit","messagePattern":"local capsule source (.+?) is (.+?) bytes, exceeding the (.+?)-byte member limit","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/distro/local_source.rs","lineNumber":86,"sourceCode":"        bail!(\"local capsule source {source:?} escapes the authenticated Distro.toml directory\");\n    }\n\n    let canonical_root = root\n        .canonicalize()\n        .with_context(|| format!(\"failed to resolve Distro.toml directory {}\", root.display()))?;\n    let canonical_path = candidate\n        .canonicalize()\n        .with_context(|| format!(\"failed to resolve local capsule source {source:?}\"))?;\n    if !canonical_path.starts_with(&canonical_root) {\n        bail!(\"local capsule source {source:?} escapes the authenticated Distro.toml directory\");\n    }\n    let metadata = std::fs::metadata(&canonical_path)\n        .with_context(|| format!(\"failed to stat local capsule source {source:?}\"))?;\n    if !metadata.is_file() {\n        bail!(\"local capsule source {source:?} is not a regular file\");\n    }\n    if metadata.len() > MAX_MEMBER_BYTES {\n        bail!(\n            \"local capsule source {source:?} is {} bytes, exceeding the \\\n             {MAX_MEMBER_BYTES}-byte member limit\",\n            metadata.len()\n        );\n    }\n\n    Ok(Some(canonical_path))\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn resolves_relative_member_from_manifest_parent() {\n        let dir = tempfile::tempdir().unwrap();\n        let manifest = dir.path().join(\"Distro.toml\");\n        std::fs::create_dir_all(dir.path().join(\"capsules\")).unwrap();","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/distro/local_source.rs#L68-L104","documentation":"resolve_local_capsule_archive enforces MAX_MEMBER_BYTES on every local capsule member to bound memory/disk use. If the file's size exceeds the limit, the source is rejected with a message reporting its actual byte size and the configured cap.","triggerScenarios":"Referencing an unusually large capsule archive (> MAX_MEMBER_BYTES) as a local member in Distro.toml.","commonSituations":"Accidentally vendoring a huge artifact (debug builds, bundled binaries) as a capsule; a build script that never pruned the archive.","solutions":["Shrink or rebuild the capsule so it fits under the MAX_MEMBER_BYTES limit","Split the capsule into smaller members or move heavy assets to the registry","Strip debug symbols/unneeded payloads from the archive before sealing"],"exampleFix":"// before\nsource = \"artifacts/huge-bundle.capsule\"  // 2 GB\n// after\nsource = \"artifacts/core-min.capsule\"     // rebuilt under the size limit","handlingStrategy":"validation","validationCode":"let md = std::fs::metadata(capsule_path)?;\nif md.len() > MAX_MEMBER_BYTES {\n    anyhow::bail!(\"capsule source exceeds the {}-byte member limit\", MAX_MEMBER_BYTES);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check artifact sizes in CI before sealing","Split large payloads into multiple members or publish to the registry","Strip debug symbols and unneeded assets from capsule archives"],"tags":["capsule","size-limit","manifest"],"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"}