pola-rs/polars · critical

The crate was compiled without IPC compression. Use…

Error message

The crate was compiled without IPC compression. Use `io_ipc_compression` to read compressed IPC.

What it means

`decompress_lz4` is compiled as a stub when the `io_ipc_compression` cargo feature is disabled; calling it panics with this message. The Arrow IPC reader encountered an LZ4-compressed IPC record batch, but this build of polars-arrow cannot decompress it. The panic message points to the exact feature flag needed.

Solutions

  1. Enable the feature in Cargo.toml: polars-arrow = { version = "...", features = ["io_ipc_compression"] } (or the corresponding `polars` feature `ipc_compression`).
  2. Rewrite the IPC file uncompressed (read it with a compression-enabled build and re-save without compression).
  3. Confirm the compression flag in the IPC file metadata before reading in compression-less builds.

Example fix

// before
polars-arrow = "0.44"

// after
polars-arrow = { version = "0.44", features = ["io_ipc_compression"] }
Defensive patterns

Strategy: validation

Validate before calling

// build-time guard in your crate
cfg_if::cfg_if! {
    if #[cfg(not(feature = "io_ipc_compression"))] {
        compile_error!("io_ipc_compression is required to read compressed Arrow IPC files");
    }
}

Try / catch

// rust: since it panics, intercept at the boundary
let result = std::panic::catch_unwind(|| reader.next_batch());
match result {
    Ok(batch) => batch,
    Err(_) => return Err("IPC file is LZ4-compressed; rebuild with the io_ipc_compression feature".into()),
}

Prevention

When it happens

Trigger: Reading an Arrow IPC (Feather V2) file/stream whose record batches were written with LZ4 compression, while the crate was built without `features = ["io_ipc_compression"]`.

Common situations: Default dependency installs that omit the feature; reading IPC files produced by another tool (pyarrow, Spark) that compresses by default; after migrating from a feature-enabled build to a minimal build.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/b4cb07e058378cb7. Report an issue: GitHub.

Appendix: source

Thrown at crates/polars-arrow/src/io/ipc/compression.rs:24

#[cfg(feature = "io_ipc_compression")]
#[cfg_attr(docsrs, doc(cfg(feature = "io_ipc_compression")))]
pub fn decompress_lz4(input_buf: &[u8], output_buf: &mut [u8]) -> PolarsResult<()> {
    use std::io::Read;
    let mut decoder = lz4::Decoder::new(input_buf)?;
    decoder.read_exact(output_buf).map_err(|e| e.into())
}

#[cfg(feature = "io_ipc_compression")]
#[cfg_attr(docsrs, doc(cfg(feature = "io_ipc_compression")))]
pub fn decompress_zstd(input_buf: &[u8], output_buf: &mut [u8]) -> PolarsResult<()> {
    use std::io::Read;
    let mut decoder = zstd::Decoder::with_buffer(input_buf)?;
    decoder.read_exact(output_buf).map_err(|e| e.into())
}

#[cfg(not(feature = "io_ipc_compression"))]
pub fn decompress_lz4(_input_buf: &[u8], _output_buf: &mut [u8]) -> PolarsResult<()> {
    panic!(
        "The crate was compiled without IPC compression. Use `io_ipc_compression` to read compressed IPC."
    );
}

#[cfg(not(feature = "io_ipc_compression"))]
pub fn decompress_zstd(_input_buf: &[u8], _output_buf: &mut [u8]) -> PolarsResult<()> {
    panic!(
        "The crate was compiled without IPC compression. Use `io_ipc_compression` to read compressed IPC."
    );
}

#[cfg(feature = "io_ipc_compression")]
#[cfg_attr(docsrs, doc(cfg(feature = "io_ipc_compression")))]
pub fn compress_lz4(
    input_buf: &[u8],
    output_buf: &mut (impl std::io::Write + ?Sized),
) -> PolarsResult<()> {
    use std::io::Write;

View on GitHub (pinned to fe841f959e)