tracel-ai/burn · error
state of fusion optimization `{}` failed to decode: {err}
Error message
state of fusion optimization `{}` failed to decode: {err} What it means
Decode guard on stored fusion-optimization state: `OptimizationState::decode::<T>` expects the CBOR bytes to deserialize into the requested type T. The panic fires when the stored state was written by a different optimization that happens to share the same `name`, or by an incompatible version of the same optimization, so the bytes do not match T's schema.
Source
Thrown at crates/burn-cubecl-fusion/src/optim/base.rs:181
name: name.to_string(),
state: {
let mut bytes = Vec::new();
ciborium::into_writer(state, &mut bytes)
.expect("fusion optimization state must be serializable");
bytes
},
}
}
/// Decode the optimization's state.
///
/// # Panics
///
/// When the bytes don't decode as `T` — the state was produced by a
/// different optimization sharing the name, or by an incompatible version.
pub fn decode<T: DeserializeOwned>(&self) -> T {
ciborium::from_reader(self.state.as_slice()).unwrap_or_else(|err| {
panic!(
"state of fusion optimization `{}` failed to decode: {err}",
self.name
)
})
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn state_round_trips_through_bytes() {
let state = CubeOptimizationState::new("custom", &vec![3u32, 7]);
assert_eq!(state.name, "custom");
assert_eq!(state.decode::<Vec<u32>>(), vec![3, 7]);
}View on GitHub (pinned to d16f7ba2ed)
Solutions
- Decode with the exact state type the optimization originally serialized (matching name AND type).
- Bump or namespace the optimization name when its state layout changes, so old states are not mistaken for new ones.
- Delete the stale checkpoint/cache containing the incompatible state and let the optimization re-initialize.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/burn-cubecl-fusion/src/optim/base.rs:181 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/ce2fa9710ee1c36e.
Report an issue: GitHub.