{"record":{"id":"b9918fca5e1562f3","repo":"astrid-runtime/astrid","slug":"capsule-entry-path-size-changed-while-hashing","errorCode":null,"errorMessage":"capsule entry '{path}' size changed while hashing","messagePattern":"capsule entry '(.+?)' size changed while hashing","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-build/src/artifact.rs","lineNumber":320,"sourceCode":"        bail!(\"capsule archive contains an empty path\");\n    }\n    Ok(parts.join(\"/\"))\n}\n\nfn hash_reader(path: String, size: u64, reader: &mut impl Read) -> anyhow::Result<ContentRecord> {\n    let mut hasher = blake3::Hasher::new();\n    let mut read = 0_u64;\n    let mut buffer = [0_u8; 16 * 1024];\n    loop {\n        let count = reader.read(&mut buffer)?;\n        if count == 0 {\n            break;\n        }\n        hasher.update(&buffer[..count]);\n        read = read.saturating_add(count as u64);\n    }\n    if read != size {\n        bail!(\"capsule entry '{path}' size changed while hashing\");\n    }\n    Ok(ContentRecord {\n        path,\n        size,\n        hash: *hasher.finalize().as_bytes(),\n    })\n}\n\nfn digest_records(mut records: Vec<ContentRecord>) -> anyhow::Result<String> {\n    records.sort_unstable_by(|left, right| left.path.cmp(&right.path));\n    if records.windows(2).any(|pair| pair[0].path == pair[1].path) {\n        bail!(\"capsule content tree contains duplicate paths\");\n    }\n    let mut hasher = blake3::Hasher::new();\n    hasher.update(CONTENT_DOMAIN);\n    for record in records {\n        let path = record.path.as_bytes();\n        hasher.update(&(path.len() as u64).to_le_bytes());","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-build/src/artifact.rs#L302-L338","documentation":"Fired by hash_reader when the bytes actually read from a capsule entry differ from the tar header's declared size, meaning the archive entry is truncated, corrupted, or being mutated while the digest is computed.","triggerScenarios":"Thrown at crates/astrid-build/src/artifact.rs:320 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-download or rebuild the capsule archive; it is corrupt or was truncated","Verify the storage medium and free disk space","Re-run the operation after no other process is writing the file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}