facebook/flow · error
failed to deserialize Exports
Error message
failed to deserialize Exports
What it means
Panics when bincode fails to decode an Exports record from decompressed bytes. Exports is part of the per-file heap cache; no file_key is needed, so the failure is straightforwardly corrupt input or a layout change between the flow build that wrote the bytes and the one reading them.
Source
Thrown at rust_port/crates/flow_heap_serialization/src/lib.rs:130
set_file_key(file_key);
let (file_sig, _): (FileSig, _) =
bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())
.expect("failed to deserialize FileSig");
clear_file_key();
Arc::new(file_sig)
}
pub fn serialize_exports(exports: &Exports) -> Vec<u8> {
let bytes = bincode::serde::encode_to_vec(exports, bincode::config::legacy())
.expect("failed to serialize Exports");
compress(&bytes)
}
pub fn deserialize_exports(bytes: &[u8]) -> Arc<Exports> {
let decompressed = decompress(bytes);
let (exports, _): (Exports, _) =
bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())
.expect("failed to deserialize Exports");
Arc::new(exports)
}
pub fn serialize_imports(imports: &Imports) -> Vec<u8> {
let bytes = bincode::serde::encode_to_vec(imports, bincode::config::legacy())
.expect("failed to serialize Imports");
compress(&bytes)
}
pub fn deserialize_imports(bytes: &[u8]) -> Arc<Imports> {
let decompressed = decompress(bytes);
let (imports, _): (Imports, _) =
bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())
.expect("failed to deserialize Imports");
Arc::new(imports)
}
pub fn serialize_file_sig_with_errors(View on GitHub (pinned to f88ac94bcf)
Solutions
- Remove the corrupt exports cache so it is rebuilt
- Namespace caches by binary version
- Use atomic writes when producing cache files
Defensive patterns
Strategy: fallback
Try / catch
match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
flow_heap_serialization::deserialize_exports(&bytes)
})) {
Ok(e) => e,
Err(_) => { invalidate_saved_state(); recompute_exports()? }
} Prevention
- Treat export-cache panics as cache misses and rebuild
- Bump a version marker in cache paths whenever Exports serialization changes
- Avoid concurrent writers to the same cache file
When it happens
Trigger: deserialize_exports on truncated/corrupt cache bytes; exports schema changed between versions without invalidating the saved state; reading a file of a different record type.
Common situations: Version skew in reused saved-state dirs; interrupted cache writes; shared caches across environments.
Related errors
- failed to deserialize AST
- failed to deserialize Docblock
- failed to deserialize PackedALocTable
- failed to deserialize type sig Module
- failed to deserialize FileSig
AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20).
Data as JSON: /api/errors/148f8e20cf3a61ca.
Report an issue: GitHub.