{"record":{"id":"c23b5807e88740d3","repo":"pola-rs/polars","slug":"invalid-value-for-polars-csv-chunk-prefetch-limit","errorCode":null,"errorMessage":"invalid value for POLARS_CSV_CHUNK_PREFETCH_LIMIT: {x}","messagePattern":"invalid value for POLARS_CSV_CHUNK_PREFETCH_LIMIT: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-stream/src/nodes/io_sources/csv/builder.rs","lineNumber":59,"sourceCode":"\n    fn reader_capabilities(&self) -> ReaderCapabilities {\n        use ReaderCapabilities as RC;\n\n        if self.options.parse_options.comment_prefix.is_some() {\n            RC::empty()\n        } else {\n            RC::PRE_SLICE\n        }\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_CSV_CHUNK_PREFETCH_LIMIT\")\n            .map(|x| {\n                x.parse::<NonZeroUsize>()\n                    .ok()\n                    .unwrap_or_else(|| {\n                        panic!(\"invalid value for POLARS_CSV_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                \"[CsvReaderBuilder]: 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/csv/builder.rs#L41-L77","documentation":"Panic in CsvReaderBuilder::set_execution_state: POLARS_CSV_CHUNK_PREFETCH_LIMIT was set but failed to parse as a NonZeroUsize (non-numeric, zero, or overflow). The CSV chunk prefetch pipeline defaults are replaced by this env var, so an invalid value aborts streaming setup with the raw string {x}.","triggerScenarios":"Invalid (unparseable) value in POLARS_CSV_CHUNK_PREFETCH_LIMIT.","commonSituations":"See trigger scenarios.","solutions":["Set POLARS_CSV_CHUNK_PREFETCH_LIMIT to a positive integer or unset it."],"exampleFix":"export POLARS_CSV_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"}