{"record":{"id":"25a5129527dab01c","repo":"tracel-ai/burn","slug":"deserialize-tuple-struct-is-not-implemented","errorCode":null,"errorMessage":"deserialize_tuple_struct is not implemented","messagePattern":"deserialize_tuple_struct is not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-store/src/nested/de.rs","lineNumber":377,"sourceCode":"    }\n\n    fn deserialize_tuple<V>(self, _len: usize, _visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        unimplemented!(\"deserialize_tuple is not implemented\")\n    }\n\n    fn deserialize_tuple_struct<V>(\n        self,\n        _name: &'static str,\n        _len: usize,\n        _visitor: V,\n    ) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        unimplemented!(\"deserialize_tuple_struct is not implemented\")\n    }\n\n    fn deserialize_enum<V>(\n        self,\n        _name: &'static str,\n        variants: &'static [&'static str],\n        visitor: V,\n    ) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        fn clone_unsafely<T>(thing: &T) -> T {\n            unsafe {\n                let mut clone = std::mem::MaybeUninit::<T>::uninit();\n                let clone_ptr = clone.as_mut_ptr();\n                ptr::copy_nonoverlapping(thing as *const T, clone_ptr, 1);\n                clone.assume_init()\n            }","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-store/src/nested/de.rs#L359-L395","documentation":"The nested-value deserializer panics on `deserialize_tuple_struct` because tuple structs (e.g., `struct Id(u32)`) have no NestedValue representation. Any record type containing a tuple-struct field routes here and hits the deliberate unimplemented!().","triggerScenarios":"Deserializing a Burn record that includes a tuple-struct (newtype struct with multiple fields, or any struct declared with parentheses) among its fields, via the nested-value recorder load path.","commonSituations":"Wrapper/newtype patterns in record items; schema refactors introducing tuple structs across Burn versions; version mismatch between saving and loading code.","solutions":["Convert the tuple struct to a named-field struct so it deserializes via deserialize_struct.","For single-field newtypes, ensure serde treats them as transparent and the inner type uses a supported deserialize_* method, or inline the inner value.","Use #[serde(deserialize_with)] to build the tuple struct from a supported seq/map representation.","Regenerate the checkpoint to match the supported record schema."],"exampleFix":"// before\nstruct Id(u32);\nstruct Item { id: Id } // -> deserialize_tuple_struct panic\n// after\n#[derive(Deserialize)]\nstruct Id { value: u32 }\nstruct Item { id: Id }","handlingStrategy":"validation","validationCode":"// Convert tuple structs to named-field structs:\n// struct Id(u32);            // panics\n// struct Id { value: u32 }   // supported via deserialize_struct","typeGuard":null,"tryCatchPattern":"let record = std::panic::catch_unwind(|| from_nested_value::<MyItem>(value.clone()))\n    .map_err(|_| \"record contains tuple struct: not supported by nested deserializer\");","preventionTips":["Avoid tuple structs (including multi-field wrappers) in record item types.","Prefer named-field structs so serde uses deserialize_struct.","Round-trip test records whenever wrapper types change."],"tags":["rust","serde","deserialization","burn","panic","tuple-struct"],"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"}