facebook/flow · error
failed to deserialize FileSig
Error message
failed to deserialize FileSig
What it means
Panics when bincode fails to decode a FileSig from decompressed bytes. FileSig caches per-file signatures (content hash, dependencies) used to decide rechecking; the file_key thread-local is set before decoding because locations are resolved against it. Corruption or writer/reader version mismatch triggers the panic.
Source
Thrown at rust_port/crates/flow_heap_serialization/src/lib.rs:115
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)
}
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)
}
View on GitHub (pinned to f88ac94bcf)
Solutions
- Delete the file-sig cache/saved state so signatures are recomputed
- Version-stamp cache paths so old entries are never read by new binaries
- Write cache entries atomically (temp + rename)
Defensive patterns
Strategy: fallback
Try / catch
match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
flow_heap_serialization::deserialize_file_sig(&file_key, &bytes)
})) {
Ok(s) => s,
Err(_) => { std::fs::remove_file(&cache_path).ok(); recompute_file_sig(&file_key)? }
} Prevention
- Clear file-sig caches when switching flow versions
- Write cache entries atomically so truncated records never appear
- Verify recorded vs actual file size before deserializing
When it happens
Trigger: deserialize_file_sig on a file-sig cache entry that is truncated, from another flow version, or decoded under the wrong file_key; cache files partially overwritten.
Common situations: Saved state reused across flow upgrades; a killed daemon leaving half-written sig files; cache dirs copied between machines with different builds.
Related errors
- failed to deserialize FileSig with errors
- failed to deserialize AST
- failed to deserialize Docblock
- failed to deserialize PackedALocTable
- failed to deserialize type sig Module
AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20).
Data as JSON: /api/errors/2d1b7d40509a1efd.
Report an issue: GitHub.