{"record":{"id":"35035b8dc986474d","repo":"pola-rs/polars","slug":"invalid-value-for-polars-max-concurrent-scans-x","errorCode":null,"errorMessage":"invalid value for POLARS_MAX_CONCURRENT_SCANS: {x}","messagePattern":"invalid value for POLARS_MAX_CONCURRENT_SCANS: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-stream/src/nodes/io_sources/multi_scan/functions/mod.rs","lineNumber":46,"sourceCode":"\n    let max_files_with_slice = match pre_slice {\n        // Calculate the max number of files assuming 1 row per file.\n        Some(v @ Slice::Positive { .. }) => v.end_position().max(1),\n        Some(Slice::Negative { .. }) | None => usize::MAX,\n    };\n\n    // Set this generously high, there are users who scan 10,000's of small files from the cloud.\n    num_pipelines\n        .saturating_add(3)\n        .min(max_files_with_slice)\n        .min(num_sources)\n        .clamp(1, 128)\n}\n\npub fn calc_max_concurrent_scans(num_pipelines: usize, num_sources: usize) -> usize {\n    if let Ok(v) = std::env::var(\"POLARS_MAX_CONCURRENT_SCANS\").map(|x| {\n        x.parse::<NonZeroUsize>()\n            .unwrap_or_else(|_| panic!(\"invalid value for POLARS_MAX_CONCURRENT_SCANS: {x}\"))\n            .get()\n    }) {\n        return v;\n    }\n\n    num_pipelines.min(num_sources).clamp(1, 128)\n}\n\npub async fn is_compressed_source(\n    scan_source: ScanSource,\n    cloud_options: Option<Arc<CloudOptions>>,\n    io_metrics: Option<Arc<IOMetrics>>,\n) -> PolarsResult<bool> {\n    let byte_source_builder = if scan_source.is_cloud_url() || polars_config::config().force_async()\n    {\n        DynByteSourceBuilder::ObjectStore(FetchConfig::legacy())\n    } else {\n        DynByteSourceBuilder::Mmap","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/crates/polars-stream/src/nodes/io_sources/multi_scan/functions/mod.rs#L28-L64","documentation":"Panic in calc_max_concurrent_scans: POLARS_MAX_CONCURRENT_SCANS was set but cannot be parsed as a usize. The env var caps how many files multi-scan reads in parallel; the malformed string {x} aborts scan planning.","triggerScenarios":"Invalid value in POLARS_MAX_CONCURRENT_SCANS.","commonSituations":"See trigger scenarios.","solutions":["Set POLARS_MAX_CONCURRENT_SCANS to a positive integer or unset it."],"exampleFix":"export POLARS_MAX_CONCURRENT_SCANS=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"}