pola-rs/polars · error

invalid value for POLARS_MEMORY_PREFETCH: {v}

Error message

invalid value for POLARS_MEMORY_PREFETCH: {v}

What it means

Panic at the fall-through arm of the POLARS_MEMORY_PREFETCH match: the variable's value {v} matched none of the accepted strategies ('no_prefetch', 'prefetch_l2', 'madvise_sequential', 'madvise_willneed', 'madvise_populate_read') nor None, so prefetch configuration aborts with the unrecognized string.

Source

Thrown at crates/polars-utils/src/mem.rs:155

                    panic!(
                        "POLARS_MEMORY_PREFETCH=madvise_willneed is not supported by this system"
                    );
                }
            },
            Some("madvise_populate_read") => {
                #[cfg(target_os = "linux")]
                {
                    madvise_populate_read
                }
                #[cfg(not(target_os = "linux"))]
                {
                    panic!(
                        "POLARS_MEMORY_PREFETCH=madvise_populate_read is not supported by this system"
                    );
                }
            },
            Some("force_populate_read") => force_populate_read,
            Some(v) => panic!("invalid value for POLARS_MEMORY_PREFETCH: {v}"),
        };

        if verbose {
            let func_name = match memory_prefetch_func as usize {
                v if v == no_prefetch as *const () as usize => "no_prefetch",
                v if v == prefetch_l2 as *const () as usize => "prefetch_l2",
                v if v == madvise_sequential as *const () as usize => "madvise_sequential",
                v if v == madvise_willneed as *const () as usize => "madvise_willneed",
                v if v == madvise_populate_read as *const () as usize => "madvise_populate_read",
                v if v == force_populate_read as *const () as usize => "force_populate_read",
                _ => unreachable!(),
            };

            eprintln!("memory prefetch function: {func_name}");
        }

        memory_prefetch_func
    }

View on GitHub (pinned to 9b5d73fd00)

Solutions

  1. Set POLARS_MEMORY_PREFETCH to one of the supported modes (e.g. madvise_sequential, madvise_willneed, madvise_populate_read) or unset it.

Example fix

export POLARS_MEMORY_PREFETCH=madvise_willneed
Defensive patterns

Strategy: validation

When it happens

Trigger: POLARS_MEMORY_PREFETCH contains an unrecognized value.

Common situations: See trigger scenarios.


AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19). Data as JSON: /api/errors/b5fc7b911836135e. Report an issue: GitHub.