{"record":{"id":"b564d622fd157fab","repo":"facebook/flow","slug":"failed-to-deserialize-packedaloctable","errorCode":null,"errorMessage":"failed to deserialize PackedALocTable","messagePattern":"failed to deserialize PackedALocTable","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust_port/crates/flow_heap_serialization/src/lib.rs","lineNumber":84,"sourceCode":"    set_file_key(file_key);\n    let (docblock, _): (Docblock, _) =\n        bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())\n            .expect(\"failed to deserialize Docblock\");\n    clear_file_key();\n    Arc::new(docblock)\n}\n\npub fn serialize_aloc_table(table: &PackedALocTable) -> Vec<u8> {\n    let bytes = bincode::serde::encode_to_vec(table, bincode::config::legacy())\n        .expect(\"failed to serialize PackedALocTable\");\n    compress(&bytes)\n}\n\npub fn deserialize_aloc_table(bytes: &[u8]) -> Arc<PackedALocTable> {\n    let decompressed = decompress(bytes);\n    let (table, _): (PackedALocTable, _) =\n        bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())\n            .expect(\"failed to deserialize PackedALocTable\");\n    Arc::new(table)\n}\n\npub fn serialize_type_sig(module: &Module<Loc>) -> Vec<u8> {\n    let bytes = bincode::serde::encode_to_vec(module, bincode::config::legacy())\n        .expect(\"failed to serialize type sig Module\");\n    compress(&bytes)\n}\n\npub fn deserialize_type_sig(file_key: &FileKey, bytes: &[u8]) -> Arc<Module<Loc>> {\n    let decompressed = decompress(bytes);\n    set_file_key(file_key);\n    let (module, _): (Module<Loc>, _) =\n        bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())\n            .expect(\"failed to deserialize type sig Module\");\n    clear_file_key();\n    Arc::new(module)\n}","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_heap_serialization/src/lib.rs#L66-L102","documentation":"Panics when bincode fails to decode a PackedALocTable from decompressed bytes. This record carries no file_key (no Loc thread-local needed), so failure is purely data corruption or layout mismatch between the writer and reader of the table.","triggerScenarios":"deserialize_aloc_table on bytes from a different flow version whose PackedALocTable layout changed; truncated or bit-flipped cache files; feeding it bytes of another record type.","commonSituations":"Version skew between the flow that saved the server state and the one that restarts from it; killed writer leaving partial files; caches on flaky storage.","solutions":["Delete the corrupt aloc-table cache/saved state so it is rebuilt","Version-stamp or namespace cache files by binary version to prevent cross-version reads","Write caches atomically so truncated tables never become visible"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {\n    flow_heap_serialization::deserialize_aloc_table(&bytes)\n})) {\n    Ok(t) => t,\n    Err(_) => { invalidate_saved_state(); rebuild_aloc_table()? }\n}","preventionTips":["Invalidate saved state after any change to PackedALocTable serialization","Write tables atomically; verify file sizes before loading","Don't share one cache dir between different flow versions"],"tags":["rust","bincode","serialization","aloc-table","saved-state"],"backgroundTag":"bincode-decode-error","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T11:17:13.642Z"}