{"record":{"id":"b2a50d9629fee224","repo":"Hmbown/CodeWhale","slug":"fleet-artifact-exceeds-the-16-mib-verification-limit","errorCode":null,"errorMessage":"Fleet artifact exceeds the 16 MiB verification limit","messagePattern":"Fleet artifact exceeds the 16 MiB verification limit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/artifacts.rs","lineNumber":54,"sourceCode":"            ensure!(\n                saved == bytes,\n                \"An existing Fleet artifact contains different bytes\"\n            );\n            Ok(())\n        }\n        Err(error) => Err(error).context(\"Publishing Fleet artifact\"),\n    }\n}\n\npub(crate) fn read_verified(\n    workspace: &Path,\n    artifact: &FleetArtifactRef,\n    preview_limit: u64,\n) -> Result<(Vec<u8>, u64)> {\n    let parent = WorkspaceFile::open(workspace, &artifact.path, false)?;\n    let file = parent.open_file()?;\n    let size = file.metadata()?.len();\n    ensure!(\n        size <= MAX_ARTIFACT_BYTES,\n        \"Fleet artifact exceeds the 16 MiB verification limit\"\n    );\n    ensure!(\n        artifact.size_bytes.is_none_or(|expected| expected == size),\n        \"Fleet artifact size changed\"\n    );\n    let checksum = artifact\n        .checksum\n        .as_deref()\n        .context(\"Fleet artifact has no recorded checksum\")?;\n    let mut hasher = Sha256::new();\n    let mut preview = Vec::new();\n    let mut buffer = [0_u8; 8192];\n    let mut total = 0_u64;\n    // The digest and returned preview consume exactly the same bytes from the\n    // same opened file. A changed/replaced pathname is never reopened for data.\n    let mut reader = (&file).take(size + 1);","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/artifacts.rs#L36-L72","documentation":"read_verified refuses to verify a Fleet artifact whose on-disk size exceeds the shared 16 MiB MAX_ARTIFACT_BYTES ceiling. The writer and reader share this limit so no artifact can be published that the evidence reader cannot fully stream and hash. This fails closed before reading if the file already exceeds it.","triggerScenarios":"Calling read_verified for a FleetArtifactRef whose file metadata reports len() > 16 MiB — e.g. the artifact was written by an older build without the ceiling, or placed into the workspace by an external process.","commonSituations":"Mixing artifacts produced by a pre-limit version of the tool with a current reader; an external tool or manual copy dropped a large file at the artifact path; a symlink pointing at a big file elsewhere in the workspace.","solutions":["Remove or relocate the oversized file from the Fleet workspace — it is not a valid artifact under the current limit.","Republish the content in a truncated/compressed form via artifacts::write so it fits the ceiling.","Check how the file got there (old binary version, external script) and stop that writer from exceeding 16 MiB."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let size = fs::metadata(ws.join(&artifact.path))?.len();\nif size > 16 * 1024 * 1024 {\n    return Err(\"artifact exceeds 16 MiB verification limit; remove or republish smaller\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only consume artifacts produced by the current version of the writer (which enforces the ceiling).","Keep external tools from copying large files into the Fleet workspace.","Check artifact size after any workspace migration."],"tags":["fleet","artifacts","size-limit","verification"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T06:17:15.046Z"}