{"record":{"id":"87ca42410c7686f2","repo":"tracel-ai/burn","slug":"deserialize-i8-is-not-implemented","errorCode":null,"errorMessage":"deserialize_i8 is not implemented","messagePattern":"deserialize_i8 is not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-store/src/nested/de.rs","lineNumber":167,"sourceCode":"                \"Expected map value but got {:?}\",\n                self.value\n            ))),\n        }\n    }\n\n    fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        let val = self.extract_scalar(\"bool\", |v| v.clone().as_bool())?;\n        visitor.visit_bool(val)\n    }\n\n    fn deserialize_i8<V>(self, _visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        unimplemented!(\"deserialize_i8 is not implemented\")\n    }\n\n    fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        let val = self.extract_scalar(\"i16\", |v| v.clone().as_i16())?;\n        visitor.visit_i16(val)\n    }\n\n    fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        let val = self.extract_scalar(\"i32\", |v| v.clone().as_i32())?;\n        visitor.visit_i32(val)\n    }\n","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-store/src/nested/de.rs#L149-L185","documentation":"The nested-value deserializer in burn-store does not implement serde's `deserialize_i8`; it panics with unimplemented!(). NestedValue-backed record deserialization only supports wider integer widths, so any struct field of type i8 (or an i8-typed enum payload) reached during record deserialization hits this panic.","triggerScenarios":"Loading a Burn module/record whose deserialized type contains an `i8` field, causing serde to call Deserializer::deserialize_i8 during `from_nested_value` / recorder load.","commonSituations":"A record item struct changed between Burn versions to include an i8 field; user-defined record items or custom adapters storing byte-sized values; loading checkpoints saved by newer Burn versions into older code (or vice versa) where field types differ.","solutions":["Change the field type in the record item from i8 to i16/i32/i64 and convert after deserialization.","Wrap the i8 field with #[serde(deserialize_with)] using a function that reads an i16 and casts to i8.","Regenerate/re-save the checkpoint so its record structure matches types the nested deserializer supports.","Verify Burn version match between the code that saved the record and the code loading it."],"exampleFix":"// before\n#[derive(Deserialize)]\nstruct Item { flag: i8 } // -> deserialize_i8 panic\n// after\n#[derive(Deserialize)]\nstruct Item { flag: i16 }\nimpl Item { fn flag(&self) -> i8 { self.flag as i8 } }","handlingStrategy":"validation","validationCode":"// Reject i8 fields in record item structs before loading\nfn assert_no_i8_fields<T>(_t: &T) { /* audit: grep record types for \": i8\" */ }\n// or deserialize_with:\nfn i8_from_i16<'de, D: serde::Deserializer<'de>>(d: D) -> Result<i8, D::Error> {\n    Ok(i8::try_from(i16::deserialize(d)).map_err(serde::de::Error::custom)?)\n}","typeGuard":null,"tryCatchPattern":"let record = std::panic::catch_unwind(|| from_nested_value::<MyItem>(value.clone()))\n    .unwrap_or_else(|_| panic!(\"record contains i8: not supported by nested deserializer\"));","preventionTips":["Use i16/i32/i64 for integer fields in record item structs; cast to i8 afterwards.","Round-trip test records after any field type change.","Keep Burn versions matched between checkpoint writers and readers."],"tags":["rust","serde","deserialization","burn","panic","int8"],"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"}