{"record":{"id":"a745659f958ff3bd","repo":"BoundaryML/baml","slug":"kind-artifact-failed-integrity-validation","errorCode":null,"errorMessage":"{kind} artifact failed integrity validation","messagePattern":"(.+?) artifact failed integrity validation","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_artifact/src/lib.rs","lineNumber":131,"sourceCode":"}\n\n#[derive(Debug, thiserror::Error)]\npub enum Error {\n    #[error(\"{kind} artifact is truncated\")]\n    Truncated { kind: ArtifactKind },\n    #[error(\n        \"{kind} is not a versioned BAML artifact; {}\",\n        kind.remediation()\n    )]\n    InvalidMagic { kind: ArtifactKind },\n    #[error(\"invalid {kind} artifact header: {message}\")]\n    InvalidHeader { kind: ArtifactKind, message: String },\n    #[error(\"expected {expected} artifact, found {actual}\")]\n    WrongKind {\n        expected: ArtifactKind,\n        actual: ArtifactKind,\n    },\n    #[error(\"{kind} artifact failed integrity validation\")]\n    InvalidPayloadHash { kind: ArtifactKind },\n    #[error(\n        \"{kind}: toolchain {artifact_fingerprint} / format {artifact_format}; this runtime: {runtime_fingerprint} / format {runtime_format} — {remediation}\"\n    )]\n    Incompatible {\n        kind: ArtifactKind,\n        artifact_fingerprint: String,\n        artifact_format: u32,\n        runtime_fingerprint: &'static str,\n        runtime_format: u32,\n        remediation: &'static str,\n    },\n    #[error(\"failed to encode {kind}: {message}\")]\n    Encode { kind: ArtifactKind, message: String },\n    #[error(\"failed to decode {kind}: {message}\")]\n    Decode { kind: ArtifactKind, message: String },\n}\n","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_artifact/src/lib.rs#L113-L149","documentation":"`Error::InvalidPayloadHash` means the artifact's declared payload hash does not match the hash of the bytes actually present, so the payload has been altered or corrupted since encoding. This is the crate's integrity check protecting against tampered or damaged artifacts.","triggerScenarios":"Decoding an artifact whose payload bytes differ from the hash recorded in the header — bit flips on disk, in-flight corruption, or post-encoding modification of the payload region.","commonSituations":"Faulty storage or flaky network corrupting the artifact file; a tool that rewrites the file after generation; syncing artifacts with tools that mangle binary content (line-ending conversion, encoding transcoding).","solutions":["Regenerate or re-download the artifact from a trusted source.","Verify the artifact checksum against the publisher's manifest before decoding.","Stop any process that rewrites the artifact after it is produced; transfer in binary mode only.","Check storage health (disk errors, flaky mounts) if corruption recurs."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const hash = crypto.createHash('sha256').update(fs.readFileSync(path)).digest('hex');\nif (hash !== manifest.artifacts['ir'].sha256) {\n  throw new Error('artifact integrity check failed; re-download');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always verify checksums before decoding artifacts.","Transfer artifacts in binary mode over reliable channels.","Investigate recurring corruption at the storage/network layer."],"tags":["artifact","integrity","hash","checksum","corruption"],"backgroundTag":"checksum-mismatch","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}