{"record":{"id":"ab773ca61bed5bf7","repo":"tracel-ai/burn","slug":"tuple-variant-is-not-implemented-because-it-is-not","errorCode":null,"errorMessage":"tuple variant is not implemented because it is not used in the burn module","messagePattern":"tuple variant is not implemented because it is not used in the burn module","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-store/src/nested/de.rs","lineNumber":713,"sourceCode":"                        Err(Error::Other(\"Wrong variant\".to_string()))\n                    }\n                }\n                Some(other) => Err(custom_err(format!(\n                    \"expected DType variant as string, got {other:?}\"\n                ))),\n                None => Err(custom_err(\"expected map containing 'DType' key for enum\")),\n            },\n            other => Err(custom_err(format!(\n                \"expected map for enum variant, got {other:?}\"\n            ))),\n        }\n    }\n\n    fn tuple_variant<V>(self, _len: usize, _visitor: V) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        unimplemented!(\"tuple variant is not implemented because it is not used in the burn module\")\n    }\n\n    fn struct_variant<V>(\n        self,\n        _fields: &'static [&'static str],\n        _visitor: V,\n    ) -> Result<V::Value, Self::Error>\n    where\n        V: Visitor<'de>,\n    {\n        unimplemented!(\n            \"struct variant is not implemented because it is not used in the burn module\"\n        )\n    }\n}\n\n/// A wrapper for the nested value data structure with a burn module adapter.\nstruct NestedValueWrapper<A: BurnModuleAdapter> {","sourceCodeStart":695,"sourceCodeEnd":731,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-store/src/nested/de.rs#L695-L731","documentation":"The nested Deserializer's VariantAccess does not implement tuple variants. burn's module representation never uses serde tuple variants, so the method is stubbed with unimplemented! and panics if a type's Deserialize impl requests a tuple variant (deserialize_tuple_variant) during nested deserialization.","triggerScenarios":"Calling Deserialize on a type containing a tuple variant enum (e.g. `enum E { A(u32, u32) }`) through burn-store's nested value deserializer.","commonSituations":"Adding a custom layer or config type with tuple-variant enums to a model that is then saved/loaded via burn-store's nested record format.","solutions":["Replace tuple variants with struct variants in the deserialized type","Use unit variants or plain structs instead of tuple-variant enums","Implement tuple_variant in the adapter if you own a fork","Bypass the nested deserializer and use a standard serde deserializer for that type"],"exampleFix":"// before\nenum Padding { Explicit(usize, usize) }\n\n// after\nenum Padding { Explicit { top: usize, bottom: usize } }","handlingStrategy":"validation","validationCode":"// audit types before use\nfn assert_no_tuple_variants<T>() { /* rely on round-trip test */ }\n#[cfg(test)]\n#[test]\nfn roundtrip_record() {\n    let r = MyRecord::default();\n    let nv = to_nested(&r).unwrap();\n    let back: MyRecord = from_nested(nv).unwrap();\n}","typeGuard":null,"tryCatchPattern":"let result = std::panic::catch_unwind(|| MyType::deserialize(nested));\nif result.is_err() { use_struct_variant_representation(); }","preventionTips":["Use struct variants or plain structs instead of tuple variants in record types","Add round-trip deserialize tests for every record type","Avoid introducing new enum shapes into burn-store nested data"],"tags":["rust","serde","deserialization","burn"],"backgroundTag":"unimplemented-serde-deserializer","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"}