{"record":{"id":"2f83ce346b2db374","repo":"tracel-ai/burn","slug":"deserialize-bytes-is-not-implemented","errorCode":null,"errorMessage":"deserialize_bytes is not implemented","messagePattern":"deserialize_bytes is not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-store/src/nested/de.rs","lineNumber":263,"sourceCode":"        unimplemented!(\"deserialize_char is not implemented\")\n    }\n\n    fn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        match self.value {\n            Some(NestedValue::String(val)) => visitor.visit_str(&val),\n            Some(other) => Err(custom_err(format!(\"expected str but got {other:?}\"))),\n            None => Err(custom_err(\"expected str, found nothing\")),\n        }\n    }\n\n    fn deserialize_bytes<V>(self, _visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        unimplemented!(\"deserialize_bytes is not implemented\")\n    }\n\n    fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        match self.value {\n            Some(NestedValue::Bytes(bytes)) => match bytes.try_into_vec::<u8>() {\n                Ok(bytes) => visitor.visit_byte_buf(bytes),\n                Err(bytes) => visitor.visit_bytes(&bytes),\n            },\n            Some(NestedValue::U8s(bytes)) => visitor.visit_byte_buf(bytes),\n            Some(other) => Err(custom_err(format!(\n                \"expected byte buffer but got {other:?}\"\n            ))),\n            None => Err(custom_err(\"expected byte buffer, found nothing\")),\n        }\n    }","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-store/src/nested/de.rs#L245-L281","documentation":"The nested-value deserializer panics on `deserialize_bytes` because NestedValue cannot represent raw byte sequences (only typed vectors/strings). Serde calls this method for `Vec<u8>`-like targets (bytes fields), hitting the deliberate unimplemented!().","triggerScenarios":"Deserializing a record type with a field annotated #[serde(with = \"serde_bytes\")] or of a byte-buffer type (Vec<u8> routed through deserialize_bytes, Cow<[u8]>, ByteBuf) from Burn nested value data.","commonSituations":"User-defined record items that embed binary blobs or serialized payloads in checkpoint data; schema changes adding binary fields between Burn versions; attempting to store raw model bytes inside a record item.","solutions":["Store the bytes as a Vec<u8> of numeric values (deserialized via seq) or as a base64/hex String instead of a byte-buffer type.","Use #[serde(deserialize_with)] to decode a string/array field into the byte buffer you need.","Keep binary payloads out of record items — store them as separate tensors/parameters.","Regenerate the checkpoint to match the supported schema."],"exampleFix":"// before\nstruct Item { blob: serde_bytes::ByteBuf } // -> deserialize_bytes panic\n// after\nstruct Item { blob_b64: String }\n// decode: use base64::decode(&item.blob_b64)","handlingStrategy":"validation","validationCode":"// Store bytes as base64 String instead of byte buffers:\nfn bytes_from_b64<'de, D: serde::Deserializer<'de>>(d: D) -> Result<Vec<u8>, D::Error> {\n    let s = String::deserialize(d)?;\n    base64::decode(s).map_err(serde::de::Error::custom)\n}\n// avoid #[serde(with = \"serde_bytes\")] in record items","typeGuard":null,"tryCatchPattern":"let record = std::panic::catch_unwind(|| from_nested_value::<MyItem>(value.clone()))\n    .map_err(|_| \"record contains byte buffer: not supported by nested deserializer\");","preventionTips":["Do not embed raw binary blobs (Vec<u8> via serde_bytes, ByteBuf) in record items.","Encode binary data as base64/hex strings or store as tensors.","Round-trip test records after schema changes."],"tags":["rust","serde","deserialization","burn","panic","bytes"],"backgroundTag":"unsupported-deserializer-method","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}