facebook/flow · error

failed to deserialize PackedALocTable

Error message

failed to deserialize PackedALocTable

What it means

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.

Source

Thrown at rust_port/crates/flow_heap_serialization/src/lib.rs:84

    set_file_key(file_key);
    let (docblock, _): (Docblock, _) =
        bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())
            .expect("failed to deserialize Docblock");
    clear_file_key();
    Arc::new(docblock)
}

pub fn serialize_aloc_table(table: &PackedALocTable) -> Vec<u8> {
    let bytes = bincode::serde::encode_to_vec(table, bincode::config::legacy())
        .expect("failed to serialize PackedALocTable");
    compress(&bytes)
}

pub fn deserialize_aloc_table(bytes: &[u8]) -> Arc<PackedALocTable> {
    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)
}

View on GitHub (pinned to f88ac94bcf)

Solutions

  1. Delete the corrupt aloc-table cache/saved state so it is rebuilt
  2. Version-stamp or namespace cache files by binary version to prevent cross-version reads
  3. Write caches atomically so truncated tables never become visible
Defensive patterns

Strategy: fallback

Try / catch

match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
    flow_heap_serialization::deserialize_aloc_table(&bytes)
})) {
    Ok(t) => t,
    Err(_) => { invalidate_saved_state(); rebuild_aloc_table()? }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20). Data as JSON: /api/errors/b564d622fd157fab. Report an issue: GitHub.