{"record":{"id":"148f8e20cf3a61ca","repo":"facebook/flow","slug":"failed-to-deserialize-exports","errorCode":null,"errorMessage":"failed to deserialize Exports","messagePattern":"failed to deserialize Exports","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust_port/crates/flow_heap_serialization/src/lib.rs","lineNumber":130,"sourceCode":"    set_file_key(file_key);\n    let (file_sig, _): (FileSig, _) =\n        bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())\n            .expect(\"failed to deserialize FileSig\");\n    clear_file_key();\n    Arc::new(file_sig)\n}\n\npub fn serialize_exports(exports: &Exports) -> Vec<u8> {\n    let bytes = bincode::serde::encode_to_vec(exports, bincode::config::legacy())\n        .expect(\"failed to serialize Exports\");\n    compress(&bytes)\n}\n\npub fn deserialize_exports(bytes: &[u8]) -> Arc<Exports> {\n    let decompressed = decompress(bytes);\n    let (exports, _): (Exports, _) =\n        bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())\n            .expect(\"failed to deserialize Exports\");\n    Arc::new(exports)\n}\n\npub fn serialize_imports(imports: &Imports) -> Vec<u8> {\n    let bytes = bincode::serde::encode_to_vec(imports, bincode::config::legacy())\n        .expect(\"failed to serialize Imports\");\n    compress(&bytes)\n}\n\npub fn deserialize_imports(bytes: &[u8]) -> Arc<Imports> {\n    let decompressed = decompress(bytes);\n    let (imports, _): (Imports, _) =\n        bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())\n            .expect(\"failed to deserialize Imports\");\n    Arc::new(imports)\n}\n\npub fn serialize_file_sig_with_errors(","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_heap_serialization/src/lib.rs#L112-L148","documentation":"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.","triggerScenarios":"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.","commonSituations":"Version skew in reused saved-state dirs; interrupted cache writes; shared caches across environments.","solutions":["Remove the corrupt exports cache so it is rebuilt","Namespace caches by binary version","Use atomic writes when producing cache files"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {\n    flow_heap_serialization::deserialize_exports(&bytes)\n})) {\n    Ok(e) => e,\n    Err(_) => { invalidate_saved_state(); recompute_exports()? }\n}","preventionTips":["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"],"tags":["rust","bincode","serialization","exports","saved-state"],"backgroundTag":"bincode-decode-error","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T11:17:13.642Z"}