{"record":{"id":"7f26c5f6d65ae0f4","repo":"pola-rs/polars","slug":"invalid-value-for-polars-ndjson-chunk-prefetch-lim","errorCode":null,"errorMessage":"invalid value for POLARS_NDJSON_CHUNK_PREFETCH_LIMIT: {x}","messagePattern":"invalid value for POLARS_NDJSON_CHUNK_PREFETCH_LIMIT: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-stream/src/nodes/io_sources/ndjson/builder.rs","lineNumber":59,"sourceCode":"\n#[cfg(feature = \"json\")]\nimpl FileReaderBuilder for NDJsonReaderBuilder {\n    fn reader_name(&self) -> &str {\n        \"ndjson\"\n    }\n\n    fn reader_capabilities(&self) -> ReaderCapabilities {\n        ndjson_reader_capabilities()\n    }\n\n    fn set_execution_state(&self, execution_state: &crate::execute::StreamingExecutionState) {\n        // The maximum number of chunks actively being prefetched at any given point in time.\n        let prefetch_limit = std::env::var(\"POLARS_NDJSON_CHUNK_PREFETCH_LIMIT\")\n            .map(|x| {\n                x.parse::<NonZeroUsize>()\n                    .ok()\n                    .unwrap_or_else(|| {\n                        panic!(\"invalid value for POLARS_NDJSON_CHUNK_PREFETCH_LIMIT: {x}\")\n                    })\n                    .get()\n            })\n            .unwrap_or(execution_state.num_pipelines.saturating_mul(2))\n            .max(1);\n\n        self.prefetch_limit.store(prefetch_limit);\n\n        if config::verbose() {\n            eprintln!(\n                \"[NDJsonReaderBuilder]: prefetch_limit: {}\",\n                self.prefetch_limit.load()\n            );\n        }\n\n        self.prefetch_semaphore\n            .set(Arc::new(tokio::sync::Semaphore::new(prefetch_limit)))\n            .unwrap()","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/crates/polars-stream/src/nodes/io_sources/ndjson/builder.rs#L41-L77","documentation":"Panic in NDJsonReaderBuilder::set_execution_state: POLARS_NDJSON_CHUNK_PREFETCH_LIMIT was set but is not a valid NonZeroUsize (zero or non-numeric). The env var replaces the default NDJSON chunk prefetch count, so reader initialization aborts with the raw value {x}.","triggerScenarios":"Invalid value in POLARS_NDJSON_CHUNK_PREFETCH_LIMIT.","commonSituations":"See trigger scenarios.","solutions":["Set POLARS_NDJSON_CHUNK_PREFETCH_LIMIT to a positive integer or unset it."],"exampleFix":"export POLARS_NDJSON_CHUNK_PREFETCH_LIMIT=4","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}