tracel-ai/burn · error
deserialize_u32 is not implemented
Error message
deserialize_u32 is not implemented
What it means
The nested-value deserializer in burn-store panics on `deserialize_u32` because unsigned 32-bit values are not part of the supported NestedValue surface (signed ints, bools, floats, strings, etc. are). Serde routes u32 fields to this method and hits the deliberate unimplemented!().
Solutions
- Change the field to i32/i64 (which the deserializer supports) and cast to u32 after deserialization.
- Use #[serde(deserialize_with)] to read the value as i64 and convert with u32::try_from.
- Update or regenerate the checkpoint so it matches the supported record schema.
- Align Burn versions between saving and loading code.
Example fix
// before
struct Item { width: u32 } // -> deserialize_u32 panic
// after
struct Item { width: i64 }
impl Item { fn width(&self) -> u32 { self.width as u32 } } Defensive patterns
Strategy: validation
Validate before calling
// Audit record structs for u32 fields before loading; or convert at the serde level:
fn u32_from_i64<'de, D: serde::Deserializer<'de>>(d: D) -> Result<u32, D::Error> {
u32::try_from(i64::deserialize(d)).map_err(serde::de::Error::custom)
} Try / catch
let record = std::panic::catch_unwind(|| from_nested_value::<MyItem>(value.clone()))
.map_err(|_| "record contains u32: not supported by nested deserializer"); Prevention
- Prefer i32/i64 over unsigned ints in record item structs.
- Round-trip save/load tests after schema changes.
- Align Burn versions across checkpoint producers and consumers.
When it happens
Trigger: Deserializing a Burn record/struct that contains a `u32` field (e.g., an id, count, or dimension) from nested value data via the store's recorder or from_nested_value path.
Common situations: Record item structs that added or changed a field to u32 in a newer Burn release; user-written record types mirroring numeric metadata as u32; checkpoint compatibility issues after upgrading Burn.
Related errors
- deserialize_any is not implemented
- deserialize_bytes is not implemented
- deserialize_char is not implemented
- deserialize_i8 is not implemented
- deserialize_tuple is not implemented
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/8d95db53b9aee89d.
Report an issue: GitHub.
Appendix: source
Thrown at crates/burn-store/src/nested/de.rs:214
V: Visitor<'de>,
{
let val = self.extract_scalar("u8", |v| v.clone().as_u8())?;
visitor.visit_u8(val)
}
fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>,
{
let val = self.extract_scalar("u16", |v| v.clone().as_u16())?;
visitor.visit_u16(val)
}
fn deserialize_u32<V>(self, _visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>,
{
unimplemented!("deserialize_u32 is not implemented")
}
fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>,
{
let val = self.extract_scalar("u64", |v| v.clone().as_u64())?;
visitor.visit_u64(val)
}
fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>,
{
let val = self.extract_scalar("f32", |v| v.clone().as_f32())?;
visitor.visit_f32(val)
}
View on GitHub (pinned to d16f7ba2ed)