facebook/flow · error
failed to deserialize type sig Module
Error message
failed to deserialize type sig Module
What it means
Panics when bincode fails to decode a type-sig Module from decompressed bytes. The decoder sets the file_key thread-local first because Module<Loc> deserialization resolves source locations against it. A mismatch between the bytes' provenance (version/layout/file) and the current decoder is the failure mode.
Source
Thrown at rust_port/crates/flow_heap_serialization/src/lib.rs:99
let decompressed = decompress(bytes);
let (table, _): (PackedALocTable, _) =
bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())
.expect("failed to deserialize PackedALocTable");
Arc::new(table)
}
pub fn serialize_type_sig(module: &Module<Loc>) -> Vec<u8> {
let bytes = bincode::serde::encode_to_vec(module, bincode::config::legacy())
.expect("failed to serialize type sig Module");
compress(&bytes)
}
pub fn deserialize_type_sig(file_key: &FileKey, bytes: &[u8]) -> Arc<Module<Loc>> {
let decompressed = decompress(bytes);
set_file_key(file_key);
let (module, _): (Module<Loc>, _) =
bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())
.expect("failed to deserialize type sig Module");
clear_file_key();
Arc::new(module)
}
pub fn serialize_file_sig(file_sig: &FileSig) -> Vec<u8> {
let bytes = bincode::serde::encode_to_vec(file_sig, bincode::config::legacy())
.expect("failed to serialize FileSig");
compress(&bytes)
}
pub fn deserialize_file_sig(file_key: &FileKey, bytes: &[u8]) -> Arc<FileSig> {
let decompressed = decompress(bytes);
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)View on GitHub (pinned to f88ac94bcf)
Solutions
- Invalidate the signature cache so type sigs are recomputed
- Tie cache directories to the flow version (or hash of serialized type layouts)
- Regenerate any serialized test fixtures after editing Module or Loc serialization
Defensive patterns
Strategy: fallback
Try / catch
match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
flow_heap_serialization::deserialize_type_sig(&file_key, &bytes)
})) {
Ok(m) => m,
Err(_) => { invalidate_sig_cache(); recompute_sig(&file_key)? }
} Prevention
- Version-stamp signature caches by binary version or schema hash
- Regenerate fixtures after editing Module<Loc> or TolerableError serialization
- Load sig caches under the same file_key they were written with
When it happens
Trigger: deserialize_type_sig on signature-cache bytes written by a different flow build; type signature schema changes without cache invalidation; bytes decoded with a file_key that doesn't match the serialized Loc offsets.
Common situations: Reusing a sig cache after upgrading flow; multi-checkout workspaces sharing one cache dir; CI caches persisted across toolchain bumps.
Related errors
- failed to deserialize AST
- failed to deserialize Docblock
- failed to deserialize PackedALocTable
- failed to deserialize FileSig
- failed to deserialize Exports
AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20).
Data as JSON: /api/errors/2adb0ab4bcf195eb.
Report an issue: GitHub.