{"record":{"id":"3386e96cdd6c437d","repo":"facebook/flow","slug":"failed-to-deserialize-filesig-with-errors","errorCode":null,"errorMessage":"failed to deserialize FileSig with errors","messagePattern":"failed to deserialize FileSig with errors","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust_port/crates/flow_heap_serialization/src/lib.rs","lineNumber":165,"sourceCode":"\npub fn serialize_file_sig_with_errors(\n    file_sig: &FileSig,\n    errors: &[TolerableError<Loc>],\n) -> Vec<u8> {\n    let bytes = bincode::serde::encode_to_vec((file_sig, errors), bincode::config::legacy())\n        .expect(\"failed to serialize FileSig with errors\");\n    compress(&bytes)\n}\n\npub fn deserialize_file_sig_with_errors(\n    file_key: &FileKey,\n    bytes: &[u8],\n) -> (Arc<FileSig>, Arc<[TolerableError<Loc>]>) {\n    let decompressed = decompress(bytes);\n    set_file_key(file_key);\n    let ((file_sig, errors), _): ((FileSig, Vec<TolerableError<Loc>>), _) =\n        bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())\n            .expect(\"failed to deserialize FileSig with errors\");\n    clear_file_key();\n    (Arc::new(file_sig), Arc::from(errors))\n}\n","sourceCodeStart":147,"sourceCodeEnd":169,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_heap_serialization/src/lib.rs#L147-L169","documentation":"Panics when bincode fails to decode the paired (FileSig, Vec<TolerableError<Loc>>) record from decompressed bytes. This variant stores a file signature together with tolerable errors so a recheck can proceed with warnings; it needs the file_key thread-local for Loc decoding. Corrupt bytes or schema drift between writer and reader cause the failure.","triggerScenarios":"deserialize_file_sig_with_errors on a truncated or version-mismatched cache file; a change to TolerableError or FileSig serialization without invalidating saved states; decoding under a file_key that doesn't match the stored Locs.","commonSituations":"Reusing saved state across flow upgrades; killed writers leaving partial records; fixtures regenerated by an older binary.","solutions":["Invalidate the saved state containing these records so files are re-signed","Version-stamp caches by binary/serialized-schema version","Regenerate serialized fixtures after touching FileSig or TolerableError"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {\n    flow_heap_serialization::deserialize_file_sig_with_errors(&file_key, &bytes)\n})) {\n    Ok(pair) => pair,\n    Err(_) => { invalidate_saved_state(); recompute_file_sig_with_errors(&file_key)? }\n}","preventionTips":["Regenerate saved states after changing FileSig or TolerableError serialization","Namespace caches per binary version","Decode under the same file_key used at write time"],"tags":["rust","bincode","serialization","file-signature","saved-state"],"backgroundTag":"bincode-decode-error","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}