{"record":{"id":"1e06b8ddc1b5c5c8","repo":"tracel-ai/burn","slug":"deserialize-tuple-is-not-implemented","errorCode":null,"errorMessage":"deserialize_tuple is not implemented","messagePattern":"deserialize_tuple is not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-store/src/nested/de.rs","lineNumber":365,"sourceCode":"                    value,\n                    self.default_for_missing_fields,\n                )?),\n                NestedValue::F32s(_) => visitor.visit_seq(VecSeqAccess::<A, f32>::new(\n                    value,\n                    self.default_for_missing_fields,\n                )?),\n                _ => Err(custom_err(format!(\"Expected Vec but got {value:?}\"))),\n            }\n        } else {\n            Err(custom_err(\"Expected Vec but got None\"))\n        }\n    }\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],","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-store/src/nested/de.rs#L347-L383","documentation":"The nested-value deserializer panics on `deserialize_tuple` because anonymous tuples (e.g., `(i32, String)`) are not supported — only named struct fields, seqs, maps, and primitives are. Serde calls this method for tuple targets, hitting the deliberate unimplemented!().","triggerScenarios":"Loading a Burn record whose type contains a tuple field (e.g., `(usize, usize)` for a shape pair, `(f32, f32)` coordinates), routing through Deserializer::deserialize_tuple.","commonSituations":"Record items with tuple-shaped metadata (pairs, triples); schema changes introducing tuple fields across Burn versions; user-defined record structs mirroring tuple returns from APIs.","solutions":["Replace the tuple field with a named struct (e.g., struct Pair { first: T, second: U }) that deserializes via deserialize_struct.","Use Vec<T> if the tuple is homogeneous, deserialized via deserialize_seq.","Use #[serde(deserialize_with)] to convert a seq value into the tuple after loading.","Regenerate the checkpoint to match the supported schema."],"exampleFix":"// before\nstruct Item { dims: (usize, usize) } // -> deserialize_tuple panic\n// after\n#[derive(Deserialize)]\nstruct Dims { h: usize, w: usize }\nstruct Item { dims: Dims }","handlingStrategy":"validation","validationCode":"// Convert tuples to named structs or deserialize via seq:\nfn pair_from_seq<'de, D: serde::Deserializer<'de>>(d: D) -> Result<(usize, usize), D::Error> {\n    let v: Vec<usize> = Vec::deserialize(d)?;\n    match v.as_slice() { [a, b] => Ok((*a, *b)), _ => Err(serde::de::Error::custom(\"expected pair\")) }\n}","typeGuard":null,"tryCatchPattern":"let record = std::panic::catch_unwind(|| from_nested_value::<MyItem>(value.clone()))\n    .map_err(|_| \"record contains tuple: not supported by nested deserializer\");","preventionTips":["Use named structs instead of anonymous tuples in record items.","If you must keep tuples, route them through deserialize_with reading a seq.","Round-trip test record types after schema changes."],"tags":["rust","serde","deserialization","burn","panic","tuple"],"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"}