pola-rs/polars · error
invalid value for POLARS_LINES_CHUNK_PREFETCH_LIMIT: {x}
Error message
invalid value for POLARS_LINES_CHUNK_PREFETCH_LIMIT: {x} What it means
Panic in LineReaderBuilder::set_execution_state: POLARS_LINES_CHUNK_PREFETCH_LIMIT was set but cannot be parsed as a NonZeroUsize. Because the env var is meant to override the default line-reader chunk prefetch count, the malformed value {x} stops the streaming read from starting.
Source
Thrown at crates/polars-stream/src/nodes/io_sources/lines.rs:52
}
impl FileReaderBuilder for LineReaderBuilder {
fn reader_name(&self) -> &str {
"line"
}
fn reader_capabilities(&self) -> ReaderCapabilities {
ndjson_reader_capabilities()
}
fn set_execution_state(&self, execution_state: &crate::execute::StreamingExecutionState) {
// The maximum number of chunks actively being prefetched at any point in time.
let prefetch_limit = std::env::var("POLARS_LINES_CHUNK_PREFETCH_LIMIT")
.map(|x| {
x.parse::<NonZeroUsize>()
.ok()
.unwrap_or_else(|| {
panic!("invalid value for POLARS_LINES_CHUNK_PREFETCH_LIMIT: {x}")
})
.get()
})
.unwrap_or(execution_state.num_pipelines.saturating_mul(2))
.max(1);
self.prefetch_limit.store(prefetch_limit);
if config::verbose() {
eprintln!(
"[LineReaderBuilder]: prefetch_limit: {}",
self.prefetch_limit.load()
);
}
self.prefetch_semaphore
.set(Arc::new(tokio::sync::Semaphore::new(prefetch_limit)))
.unwrap()View on GitHub (pinned to 9b5d73fd00)
Solutions
- Set POLARS_LINES_CHUNK_PREFETCH_LIMIT to a positive integer or unset it.
Example fix
export POLARS_LINES_CHUNK_PREFETCH_LIMIT=4
Defensive patterns
Strategy: validation
When it happens
Trigger: Invalid value in POLARS_LINES_CHUNK_PREFETCH_LIMIT.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19).
Data as JSON: /api/errors/9140a7ea2a9a7774.
Report an issue: GitHub.