{"record":{"id":"22dc1f3a279a55a2","repo":"pola-rs/polars","slug":"invalid-value-for-polars-force-ndjson-read-size","errorCode":null,"errorMessage":"invalid value for POLARS_FORCE_NDJSON_READ_SIZE: {x}","messagePattern":"invalid value for POLARS_FORCE_NDJSON_READ_SIZE: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-stream/src/nodes/io_sources/ndjson/line_batch_distributor.rs","lineNumber":141,"sourceCode":"    prev_leftover: Buffer<u8>,\n    read_size: usize,\n    chunk_idx: usize,\n    finished: bool,\n}\n\nimpl LineBatchProducer {\n    fn new(\n        mut reader: ByteSourceReader<ReaderSource>,\n        reverse: bool,\n        row_skipper: RowSkipper,\n        uncompressed_file_size_hint: Option<usize>,\n        use_prefetch_l2: bool,\n        verbose: bool,\n    ) -> PolarsResult<Self> {\n        let fixed_read_size = std::env::var(\"POLARS_FORCE_NDJSON_READ_SIZE\")\n            .map(|x| {\n                x.parse::<NonZeroUsize>().ok().unwrap_or_else(|| {\n                    panic!(\"invalid value for POLARS_FORCE_NDJSON_READ_SIZE: {x}\")\n                })\n            })\n            .ok();\n\n        let read_size = fixed_read_size\n            .map(NonZeroUsize::get)\n            .unwrap_or_else(ByteSourceReader::<ReaderSource>::initial_read_size);\n\n        if verbose {\n            eprintln!(\n                \"[NDJson LineBatchDistributor]: \\\n                n_rows_to_skip: {}, \\\n                reverse: {reverse}, \\\n                fixed_read_size: {fixed_read_size:?}\",\n                row_skipper.cfg_n_rows_to_skip,\n            );\n        }\n","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/crates/polars-stream/src/nodes/io_sources/ndjson/line_batch_distributor.rs#L123-L159","documentation":"Panic in LineBatchProducer::new: POLARS_FORCE_NDJSON_READ_SIZE was set but failed to parse as a NonZeroUsize. This debug/override env var fixes the byte read size used by the NDJSON line batcher, so an invalid value {x} panics during producer construction.","triggerScenarios":"Invalid value in POLARS_FORCE_NDJSON_READ_SIZE.","commonSituations":"See trigger scenarios.","solutions":["Set POLARS_FORCE_NDJSON_READ_SIZE to a positive integer or unset it."],"exampleFix":"export POLARS_FORCE_NDJSON_READ_SIZE=16384","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"}