tracel-ai/burn · error
not implemented
Error message
not implemented
What it means
This Deserializer in burn-store's nested module implements only the concrete deserialize_* methods it needs (i32, etc.); deserialize_any is left as unimplemented!(). It panics whenever the deserialization is polymorphic — i.e. the Deserialize impl asks for 'any' rather than a concrete type.
Source
Thrown at crates/burn-store/src/nested/de.rs:775
originator_field_name: Option<String>,
}
impl DefaultDeserializer {
fn new(originator_field_name: Option<String>) -> Self {
Self {
originator_field_name,
}
}
}
impl<'de> serde::Deserializer<'de> for DefaultDeserializer {
type Error = Error;
fn deserialize_any<V>(self, _visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>,
{
unimplemented!()
}
fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>,
{
visitor.visit_i32(Default::default())
}
fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>,
{
visitor.visit_f32(Default::default())
}
fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error>
whereView on GitHub (pinned to d16f7ba2ed)
Solutions
- Replace dynamic types (serde_json::Value, untagged enums) in the deserialized structures with concrete typed fields
- Pin the concrete type at the call site so a specific deserialize_* method is invoked
- Implement deserialize_any in the adapter by dispatching on the actual nested value's type
- Use a self-describing serde format for dynamic parts of the data
Example fix
// before
#[derive(Deserialize)]
#[serde(untagged)]
enum Val { Int(i32), Float(f32) }
// after
#[derive(Deserialize)]
struct Val { value: f32 } Defensive patterns
Strategy: type-guard
Validate before calling
// ensure concrete primitive fields only; no untagged/dynamic types
fn is_concrete_supported<T: serde::de::DeserializeOwned>() -> bool {
std::mem::size_of::<Option<T>>() > 0 // plus design review: no serde_json::Value/untagged enums
} Type guard
fn is_supported_primitive(v: &NestedValue) -> bool {
matches!(v, NestedValue::I32(_) | NestedValue::F32(_) | NestedValue::Bool(_) | NestedValue::String(_))
} Try / catch
let r = std::panic::catch_unwind(|| T::deserialize(nested));
match r {
Ok(v) => v,
Err(_) => return Err(Error::UnsupportedDynamicType),
} Prevention
- Never put serde_json::Value or untagged enums inside burn nested records
- Use concrete typed fields so a specific deserialize_* method is called
- Review new record fields for dynamic/serde-polymorphic types
When it happens
Trigger: Deserializing a self-describing or dynamic value (e.g. serde_json::Value-like types, untagged enums, or anything whose Deserialize calls deserialize_any) via this nested deserializer.
Common situations: Using generic containers such as Box<dyn ...>, untagged/untagged-ish enums, or serde_json::Value inside types loaded through burn-store's nested record format.
Related errors
- deserialize_any is not implemented
- deserialize_i8 is not implemented
- deserialize_u32 is not implemented
- deserialize_char is not implemented
- deserialize_bytes is not implemented
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/b6b508f75d264321.
Report an issue: GitHub.