{"record":{"id":"b82e600086703ba6","repo":"tracel-ai/burn","slug":"this-should-never-be-called-since-next-key-seed-al","errorCode":null,"errorMessage":"This should never be called since next_key_seed always returns None","messagePattern":"This should never be called since next_key_seed always returns None","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-store/src/nested/de.rs","lineNumber":1008,"sourceCode":"        DefaultMapAccess\n    }\n}\n\nimpl<'de> MapAccess<'de> for DefaultMapAccess {\n    type Error = Error;\n\n    fn next_key_seed<T>(&mut self, _seed: T) -> Result<Option<T::Value>, Self::Error>\n    where\n        T: DeserializeSeed<'de>,\n    {\n        Ok(None)\n    }\n\n    fn next_value_seed<T>(&mut self, _seed: T) -> Result<T::Value, Self::Error>\n    where\n        T: DeserializeSeed<'de>,\n    {\n        unimplemented!(\"This should never be called since next_key_seed always returns None\")\n    }\n\n    fn size_hint(&self) -> Option<usize> {\n        None\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use crate::nested::adapter::DefaultAdapter;\n    use serde::Deserialize;\n\n    #[derive(Debug, Deserialize, PartialEq)]\n    struct AllScalars {\n        b: bool,\n        i16_val: i16,\n        i32_val: i32,","sourceCodeStart":990,"sourceCodeEnd":1026,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-store/src/nested/de.rs#L990-L1026","documentation":"This panic is a defensive invariant check, not a real deserialization path. The map access implementation in burn-store's nested de always returns None from next_key_seed, so next_value_seed should never be invoked; if it is, the runtime state is inconsistent and the code deliberately panics.","triggerScenarios":"A Deserialize implementation manually drives map access and calls next_value_seed after next_key_seed returned None, or an adapter bug causes value extraction without a key.","commonSituations":"Custom Deserialize/DeserializeSeed implementations that ignore next_key_seed's None and unconditionally call next_value_seed; rarely hit by end users directly.","solutions":["Fix the custom Deserialize/seed logic to stop when next_key_seed returns None","Only call next_value_seed after next_key_seed returned Some","Update burn-store to a version with corrected map access logic","Report the mismatch if it comes from the library's own deserializer"],"exampleFix":"// before\nwhile map.next_key_seed(k)? .is_some() || true {\n    map.next_value_seed(v)?;\n}\n\n// after\nwhile let Some(_) = map.next_key_seed(k)? {\n    map.next_value_seed(v)?;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let r = std::panic::catch_unwind(|| T::deserialize(nested));\nif r.is_err() {\n    // invariant broken: check map-access loop stops at next_key_seed == None\n    return Err(Error::MalformedNestedValue);\n}","preventionTips":["In custom Deserialize impls, always stop iterating when next_key_seed returns None","Only call next_value_seed after a successful next_key_seed","Keep burn-store updated; this stub protects against internal misuse"],"tags":["rust","serde","deserialization","invariant"],"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"}