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 write compressed IPC.
What it means
`compress_lz4` is a panic stub unless the `io_ipc_compression` cargo feature is enabled. Writing an Arrow IPC file with LZ4 compression requested hits this panic because the build has no LZ4 compressor linked.
Solutions
- Enable the feature in Cargo.toml: features = ["io_ipc_compression"].
- Write IPC without compression (set compression to None) if the feature cannot be added.
- Feature-gate your own compression-selection code so LZ4/zstd are only requested when the feature is on.
Example fix
// before let options = IpcWriteOptions::try_new(8, false, Compression::Lz4Raw).unwrap(); // panics without feature // after (with io_ipc_compression enabled) let options = IpcWriteOptions::try_new(8, false, Compression::Lz4Raw).unwrap(); // or, without the feature: let options = IpcWriteOptions::try_new(8, false, Compression::ZSTD).unwrap_no_comp(); // Compression::None equivalent
Defensive patterns
Strategy: validation
Validate before calling
// rust: guard compression choice at runtime
fn pick_compression(requested: Option<Compression>) -> PolarsResult<Compression> {
#[cfg(not(feature = "io_ipc_compression"))]
if matches!(requested, Some(Compression::Lz4Raw) | Some(Compression::ZSTD)) {
return Err(PolarsError::ComputeError(
"compression requested but built without io_ipc_compression".into(),
));
}
Ok(requested.unwrap_or(Compression::None))
} Try / catch
// rust
let result = std::panic::catch_unwind(|| writer.write_batch(&batch));
match result {
Ok(v) => v,
Err(_) => return Err("LZ4 IPC write unsupported in this build; enable io_ipc_compression or write uncompressed".into()),
} Prevention
- Only expose compression options in builds with io_ipc_compression enabled.
- Default IPC writes to uncompressed; make compression opt-in per feature.
- Keep dev and CI feature sets aligned with production builds.
When it happens
Trigger: Calling the IPC writer with compression set to LZ4 (e.g. `IpcWriteOptions`/encoder with `Compression::Lz4`) in a build without `io_ipc_compression`.
Common situations: Enabling IPC compression options at runtime while Cargo features are still default; size-optimization attempts on minimal builds; mismatch between documented API (compression parameter exists regardless of feature) and compiled capabilities.
Related errors
- The crate was compiled without IPC compression. Use…
- internal error: entered unreachable code
- internal error: entered unreachable code
- activate feature dynamic_group_by
- activate feature dynamic_group_by
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/d108c27ab25be89a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-arrow/src/io/ipc/compression.rs:67
}
#[cfg(feature = "io_ipc_compression")]
#[cfg_attr(docsrs, doc(cfg(feature = "io_ipc_compression")))]
pub fn compress_zstd(
input_buf: &[u8],
output_buf: &mut (impl std::io::Write + ?Sized),
level: ZstdLevel,
) -> PolarsResult<()> {
zstd::stream::copy_encode(input_buf, output_buf, level.compression_level())
.map_err(|e| e.into())
}
#[cfg(not(feature = "io_ipc_compression"))]
pub fn compress_lz4(
_input_buf: &[u8],
_output_buf: &mut (impl std::io::Write + ?Sized),
) -> PolarsResult<()> {
panic!(
"The crate was compiled without IPC compression. Use `io_ipc_compression` to write compressed IPC."
)
}
#[cfg(not(feature = "io_ipc_compression"))]
pub fn compress_zstd(
_input_buf: &[u8],
_output_buf: &mut (impl std::io::Write + ?Sized),
_level: ZstdLevel,
) -> PolarsResult<()> {
panic!(
"The crate was compiled without IPC compression. Use `io_ipc_compression` to write compressed IPC."
)
}
#[cfg(test)]
mod tests {
use super::*;View on GitHub (pinned to fe841f959e)