{"record":{"id":"8d95db53b9aee89d","repo":"tracel-ai/burn","slug":"deserialize-u32-is-not-implemented","errorCode":null,"errorMessage":"deserialize_u32 is not implemented","messagePattern":"deserialize_u32 is not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-store/src/nested/de.rs","lineNumber":214,"sourceCode":"        V: Visitor<'de>,\n    {\n        let val = self.extract_scalar(\"u8\", |v| v.clone().as_u8())?;\n        visitor.visit_u8(val)\n    }\n\n    fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        let val = self.extract_scalar(\"u16\", |v| v.clone().as_u16())?;\n        visitor.visit_u16(val)\n    }\n\n    fn deserialize_u32<V>(self, _visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        unimplemented!(\"deserialize_u32 is not implemented\")\n    }\n\n    fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        let val = self.extract_scalar(\"u64\", |v| v.clone().as_u64())?;\n        visitor.visit_u64(val)\n    }\n\n    fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        let val = self.extract_scalar(\"f32\", |v| v.clone().as_f32())?;\n        visitor.visit_f32(val)\n    }\n","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-store/src/nested/de.rs#L196-L232","documentation":"The nested-value deserializer in burn-store panics on `deserialize_u32` because unsigned 32-bit values are not part of the supported NestedValue surface (signed ints, bools, floats, strings, etc. are). Serde routes u32 fields to this method and hits the deliberate unimplemented!().","triggerScenarios":"Deserializing a Burn record/struct that contains a `u32` field (e.g., an id, count, or dimension) from nested value data via the store's recorder or from_nested_value path.","commonSituations":"Record item structs that added or changed a field to u32 in a newer Burn release; user-written record types mirroring numeric metadata as u32; checkpoint compatibility issues after upgrading Burn.","solutions":["Change the field to i32/i64 (which the deserializer supports) and cast to u32 after deserialization.","Use #[serde(deserialize_with)] to read the value as i64 and convert with u32::try_from.","Update or regenerate the checkpoint so it matches the supported record schema.","Align Burn versions between saving and loading code."],"exampleFix":"// before\nstruct Item { width: u32 } // -> deserialize_u32 panic\n// after\nstruct Item { width: i64 }\nimpl Item { fn width(&self) -> u32 { self.width as u32 } }","handlingStrategy":"validation","validationCode":"// Audit record structs for u32 fields before loading; or convert at the serde level:\nfn u32_from_i64<'de, D: serde::Deserializer<'de>>(d: D) -> Result<u32, D::Error> {\n    u32::try_from(i64::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    .map_err(|_| \"record contains u32: not supported by nested deserializer\");","preventionTips":["Prefer i32/i64 over unsigned ints in record item structs.","Round-trip save/load tests after schema changes.","Align Burn versions across checkpoint producers and consumers."],"tags":["rust","serde","deserialization","burn","panic","u32"],"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"}