tracel-ai/burn · error
deserialize_identifier is not implemented
Error message
deserialize_identifier is not implemented
What it means
This panic comes from the custom serde Deserializer in burn-store's nested value module. deserialize_identifier is a serde hook used when deserializing enum variant names (unit variants via identifier). The burn module adapter does not support deserializing enum identifiers from nested values, so the method is explicitly unimplemented — any deserializer path that reaches it panics.
Source
Thrown at crates/burn-store/src/nested/de.rs:423
let result = cloned_visitor.visit_enum(ProbeEnumAccess::<A>::new(
value.clone(),
variant.to_owned(),
self.default_for_missing_fields,
));
if result.is_ok() {
return result;
}
}
Err(custom_err("No variant match"))
}
fn deserialize_identifier<V>(self, _visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>,
{
unimplemented!("deserialize_identifier is not implemented")
}
}
/// A sequence access for a vector in the nested value data structure.
struct VecSeqAccess<A: BurnModuleAdapter, I> {
iter: Box<dyn Iterator<Item = I>>,
default_for_missing_fields: bool,
phantom: std::marker::PhantomData<A>,
}
impl<A: BurnModuleAdapter> VecSeqAccess<A, NestedValue> {
fn new(vec: NestedValue, default_for_missing_fields: bool) -> Result<Self, Error> {
match vec {
NestedValue::Vec(v) => Ok(VecSeqAccess {
iter: Box::new(v.into_iter()),
default_for_missing_fields,
phantom: std::marker::PhantomData,
}),View on GitHub (pinned to d16f7ba2ed)
Solutions
- Remove or avoid enum types in the data structure being deserialized through the nested de path (use plain structs/primitives)
- Serialize enum data as a struct variant or value the adapter supports instead of relying on identifier-based deserialization
- Open an issue or patch crates/burn-store/src/nested/de.rs to implement deserialize_identifier by matching the visitor's identifier (visit_u32/visit_str)
- Use a different serialization backend (e.g. standard serde format) for types with enums
Example fix
// before
#[derive(Serialize, Deserialize)]
enum Activation { Relu, Gelu }
// after
#[derive(Serialize, Deserialize)]
struct Activation { kind: String } Defensive patterns
Strategy: validation
Validate before calling
fn uses_enum_identifier<T: 'static>() -> bool {
// prefer: keep enums out of types deserialized via burn-store nested de
std::any::TypeId::of::<T>() != std::any::TypeId::of::<()>() && !cfg!(feature = "nested-enum-de")
}
// simpler: assert record structs contain no enum fields before saving/loading Try / catch
// burn returns Error from Deserialize; catch panic at the boundary
let result = std::panic::catch_unwind(|| {
MyRecord::deserialize(nested_value)
});
match result {
Ok(v) => v,
Err(_) => fallback_to_serde_backend(),
} Prevention
- Keep enums out of structs serialized through burn-store's nested record format
- Prefer struct/unit representations over tagged enum variants in model records
- Test save/load round-trips in CI so unimplemented deserializer paths surface early
When it happens
Trigger: Deserializing a type containing an enum whose variants are deserialized via the identifier path (e.g. serde's externally tagged unit variant representation) from a NestedValue, causing Deserializer::deserialize_identifier to be called.
Common situations: Loading a recorded model/state whose serialized types include enums (e.g. option-like enums, tagged unions) through burn-store's nested deserializer; usually surfaces after a type or record format change adds enum fields the adapter never anticipated.
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/b8b737456ed6195a.
Report an issue: GitHub.