facebook/flow · error

failed to deserialize Exports

Error message

failed to deserialize Exports

What it means

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.

Source

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

    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)
}

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

pub fn deserialize_imports(bytes: &[u8]) -> Arc<Imports> {
    let decompressed = decompress(bytes);
    let (imports, _): (Imports, _) =
        bincode::serde::decode_from_slice(&decompressed, bincode::config::legacy())
            .expect("failed to deserialize Imports");
    Arc::new(imports)
}

pub fn serialize_file_sig_with_errors(

View on GitHub (pinned to f88ac94bcf)

Solutions

  1. Remove the corrupt exports cache so it is rebuilt
  2. Namespace caches by binary version
  3. Use atomic writes when producing cache files
Defensive patterns

Strategy: fallback

Try / catch

match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
    flow_heap_serialization::deserialize_exports(&bytes)
})) {
    Ok(e) => e,
    Err(_) => { invalidate_saved_state(); recompute_exports()? }
}

Prevention

When it happens

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

Common situations: Version skew in reused saved-state dirs; interrupted cache writes; shared caches across environments.

Related errors


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