{"record":{"id":"390c324efb3e1f22","repo":"tracel-ai/burn","slug":"deserialize-char-is-not-implemented","errorCode":null,"errorMessage":"deserialize_char is not implemented","messagePattern":"deserialize_char is not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-store/src/nested/de.rs","lineNumber":245,"sourceCode":"        V: Visitor<'de>,\n    {\n        let val = self.extract_scalar(\"f32\", |v| v.clone().as_f32())?;\n        visitor.visit_f32(val)\n    }\n\n    fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        let val = self.extract_scalar(\"f64\", |v| v.clone().as_f64())?;\n        visitor.visit_f64(val)\n    }\n\n    fn deserialize_char<V>(self, _visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        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\")","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-store/src/nested/de.rs#L227-L263","documentation":"The nested-value deserializer does not implement serde's `deserialize_char`; it intentionally panics. NestedValue has no char variant, so any record type containing a `char` field (or a char-typed value reached via forward_to_deserialize_any) aborts with this unimplemented!().","triggerScenarios":"Loading a Burn module record whose type includes a `char` field, causing serde to invoke Deserializer::deserialize_char during nested-value deserialization.","commonSituations":"Record item structs that changed to include char fields across Burn versions; user-defined metadata structs with character flags; checkpoint schema drift after a Burn upgrade.","solutions":["Change the char field to String and validate/extract a single character after deserialization.","Use #[serde(deserialize_with)] to read a string of length 1 and parse it into a char.","Regenerate the checkpoint to match the supported record schema.","Keep record item types limited to primitives supported by NestedValue (strings, ints, floats, bools, vecs, maps, options)."],"exampleFix":"// before\nstruct Item { grade: char } // -> deserialize_char panic\n// after\nstruct Item { grade: String }\nimpl Item { fn grade(&self) -> char { self.grade.chars().next().unwrap() } }","handlingStrategy":"validation","validationCode":"// Replace char fields with String at the serde level:\nfn char_from_string<'de, D: serde::Deserializer<'de>>(d: D) -> Result<char, D::Error> {\n    let s = String::deserialize(d)?;\n    s.chars().next().ok_or_else(|| serde::de::Error::custom(\"empty string, expected char\"))\n}","typeGuard":null,"tryCatchPattern":"let record = std::panic::catch_unwind(|| from_nested_value::<MyItem>(value.clone()))\n    .map_err(|_| \"record contains char: not supported by nested deserializer\");","preventionTips":["Use String instead of char in record item structs.","Round-trip test record types whenever fields change.","Stick to primitives NestedValue supports (strings, ints, floats, bools, options, vecs, maps)."],"tags":["rust","serde","deserialization","burn","panic","char"],"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"}