pola-rs/polars · error
POLARS_MEMORY_PREFETCH=madvise_sequential is not supported…
Error message
POLARS_MEMORY_PREFETCH=madvise_sequential is not supported by this system
What it means
Polars panics when POLARS_MEMORY_PREFETCH=madvise_sequential is requested on a non-Unix platform. The madvise(2)-based sequential read-ahead prefetch strategy only exists on Unix (Linux/macOS); on Windows or other non-Unix targets the get_memory_prefetch_func path has no implementation and fails fast with this panic.
Solutions
- Remove POLARS_MEMORY_PREFETCH or set it to a platform-neutral value (e.g. 'none') on non-Unix systems
- Only set madvise_* prefetch values conditionally when cfg/unix (or the OS is Linux/macOS)
- Use OS-agnostic prefetch settings in shared CI configuration
Example fix
// before export POLARS_MEMORY_PREFETCH=madvise_sequential # set on Windows // after # only set on unix if [ "$(uname)" != "MINGW" ]; then export POLARS_MEMORY_PREFETCH=madvise_sequential; fi
Defensive patterns
Strategy: validation
Validate before calling
// Rust: only set madvise prefetch on unix
if cfg!(target_family = "unix") {
std::env::set_var("POLARS_MEMORY_PREFETCH", "madvise_sequential");
} Type guard
fn madvise_supported() -> bool { cfg!(target_family = "unix") } Prevention
- Gate madvise_* env values behind OS checks in scripts and CI matrices
- Use POLARS_MEMORY_PREFETCH=none (or unset) as the portable default
- Avoid copying Linux tuning env blocks verbatim to Windows hosts
When it happens
Trigger: Setting POLARS_MEMORY_PREFETCH=madvise_sequential (or madvise_willneed) and then starting a memory-prefetch-enabled scan (e.g. Parquet/NDJSON source with memory prefetch) on Windows or another non-Unix OS.
Common situations: Copying tuning environment variables from a Linux guide onto a Windows machine; CI matrices reusing the same env config across OSes; containers on Windows hosts.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- could not parse table width argument
- creating extension types not allowed - try setting the…
- integer
- invalid POLARS_REGEX_SIZE_LIMIT
- invalid value for
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/c404e050e94c7f88.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-utils/src/mem.rs:126
#[cfg(target_family = "unix")]
{
madvise_willneed
}
#[cfg(not(target_family = "unix"))]
{
no_prefetch
}
},
Some("no_prefetch") => no_prefetch,
Some("prefetch_l2") => prefetch_l2,
Some("madvise_sequential") => {
#[cfg(target_family = "unix")]
{
madvise_sequential
}
#[cfg(not(target_family = "unix"))]
{
panic!(
"POLARS_MEMORY_PREFETCH=madvise_sequential is not supported by this system"
);
}
},
Some("madvise_willneed") => {
#[cfg(target_family = "unix")]
{
madvise_willneed
}
#[cfg(not(target_family = "unix"))]
{
panic!(
"POLARS_MEMORY_PREFETCH=madvise_willneed is not supported by this system"
);
}
},
Some("madvise_populate_read") => {
#[cfg(target_os = "linux")]View on GitHub (pinned to fe841f959e)