{"record":{"id":"89d795a6cf555fd6","repo":"BoundaryML/baml","slug":"unsupported-blob-algorithm","errorCode":null,"errorMessage":"unsupported blob algorithm `{}`","messagePattern":"unsupported blob algorithm `(.+?)`","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_events/src/value/artifact.rs","lineNumber":39,"sourceCode":"    const SHA256_HEX_LEN: usize = 64;\n\n    #[must_use]\n    pub fn sha256(bytes: &[u8]) -> Self {\n        let digest = Sha256::digest(bytes);\n        let mut hex = String::with_capacity(digest.len() * 2);\n        for byte in digest {\n            let _ = write!(&mut hex, \"{byte:02x}\");\n        }\n        Self {\n            algorithm: Self::ALGORITHM_SHA256.to_string(),\n            digest: hex,\n            size_bytes: bytes.len(),\n        }\n    }\n\n    pub fn validate(&self) -> io::Result<()> {\n        if self.algorithm != Self::ALGORITHM_SHA256 {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\"unsupported blob algorithm `{}`\", self.algorithm),\n            ));\n        }\n        if self.digest.len() != Self::SHA256_HEX_LEN {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\n                    \"invalid sha256 blob digest length {}; expected {} hex characters\",\n                    self.digest.len(),\n                    Self::SHA256_HEX_LEN\n                ),\n            ));\n        }\n        if !self.digest.bytes().all(|byte| byte.is_ascii_hexdigit()) {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                \"invalid sha256 blob digest; expected only hex characters\",","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_events/src/value/artifact.rs#L21-L57","documentation":"BlobArtifact::validate checks that the artifact's algorithm field equals the only supported value, SHA-256 (ALGORITHM_SHA256); anything else yields InvalidData with the unsupported algorithm name. The library deliberately supports a single digest algorithm to keep artifact digests interoperable.","triggerScenarios":"Constructing or deserializing a BlobArtifact whose algorithm field was set to something other than \"sha256\" (e.g. from an older format, hand-built struct, or external producer), then calling validate() — also reached via normalized_digest.","commonSituations":"Artifacts produced by another tool/version using a different hash algorithm; manually editing artifact metadata; copying blob metadata between files and changing the algorithm field.","solutions":["Set the artifact's algorithm to BlobArtifact::ALGORITHM_SHA256 (the only supported value).","Re-produce the blob artifact using bex_events' own artifact constructor so digest and algorithm are consistent.","Update the producer tool/library if it emits a different algorithm.","Call validate() early on deserialized artifacts to reject unsupported ones before use."],"exampleFix":"// before\nlet mut a = BlobArtifact { algorithm: \"md5\".into(), ..meta };\na.validate()?;\n// after\nlet mut a = BlobArtifact { algorithm: BlobArtifact::ALGORITHM_SHA256.into(), ..meta };\na.validate()?;","handlingStrategy":"validation","validationCode":"if artifact.algorithm != BlobArtifact::ALGORITHM_SHA256 {\n    return Err(format!(\"unsupported blob algorithm: {}\", artifact.algorithm));\n}\nif artifact.digest.len() != BlobArtifact::SHA256_HEX_LEN {\n    return Err(\"digest must be 64 hex chars\".into());\n}","typeGuard":"fn is_sha256_artifact(a: &BlobArtifact) -> bool {\n    a.algorithm == BlobArtifact::ALGORITHM_SHA256\n        && a.digest.len() == BlobArtifact::SHA256_HEX_LEN\n}","tryCatchPattern":"match artifact.validate() {\n    Err(e) if e.kind() == std::io::ErrorKind::InvalidData => {\n        log::warn!(\"rejecting artifact: {e}\");\n        Err(ArtifactError::Unsupported)\n    }\n    other => other,\n}","preventionTips":["Always construct artifacts via the library's constructors so algorithm defaults to sha256.","Run validate() immediately after deserializing any external artifact.","Upgrade or fix producers that emit non-SHA-256 digests."],"tags":["validation","digest","unsupported","artifact"],"backgroundTag":"unsupported-enum-value","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}