{"record":{"id":"4473dae7f2f0b34a","repo":"pola-rs/polars","slug":"invalid-value-for-polars-upload-concurrency-s","errorCode":null,"errorMessage":"invalid value for POLARS_UPLOAD_CONCURRENCY: {s}","messagePattern":"invalid value for POLARS_UPLOAD_CONCURRENCY: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-io/src/configs.rs","lineNumber":25,"sourceCode":"            .unwrap_or_else(|_| panic!(\"invalid value for POLARS_UPLOAD_CHUNK_SIZE: {s}\"))\n    })\n}\n\npub fn env_partitioned_upload_chunk_size() -> Option<NonZeroUsize> {\n    std::env::var(\"POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE\")\n        .ok()\n        .map(|s| {\n            s.parse::<NonZeroUsize>().unwrap_or_else(|_| {\n                panic!(\"invalid value for POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE: {s}\")\n            })\n        })\n}\n\n/// Max concurrent tasks within a single cloud writer.\npub fn env_upload_concurrency() -> Option<NonZeroUsize> {\n    std::env::var(\"POLARS_UPLOAD_CONCURRENCY\").ok().map(|s| {\n        s.parse::<NonZeroUsize>()\n            .unwrap_or_else(|_| panic!(\"invalid value for POLARS_UPLOAD_CONCURRENCY: {s}\"))\n    })\n}\n\npub fn env_partitioned_upload_concurrency() -> Option<NonZeroUsize> {\n    std::env::var(\"POLARS_PARTITIONED_UPLOAD_CONCURRENCY\")\n        .ok()\n        .map(|s| {\n            s.parse::<NonZeroUsize>().unwrap_or_else(|_| {\n                panic!(\"invalid value for POLARS_PARTITIONED_UPLOAD_CONCURRENCY: {s}\")\n            })\n        })\n}\n\n/// Runs of this many values whose total bytes are <= `copy_buffer_reserve_size` will be copied into\n/// a single contiguous chunk.\npub(crate) fn cloud_writer_coalesce_run_length() -> usize {\n    return *COALESCE_RUN_LENGTH;\n","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-io/src/configs.rs#L7-L43","documentation":"This panic occurs when POLARS_UPLOAD_CONCURRENCY is set to something that is not a non-zero usize. The variable caps the number of concurrent upload tasks inside a single cloud writer; env_upload_concurrency parses it eagerly and panics on failure. Polars assumes any present value is intentional and valid, so no fallback is applied.","triggerScenarios":"export POLARS_UPLOAD_CONCURRENCY=0 (zero is rejected by NonZeroUsize), POLARS_UPLOAD_CONCURRENCY=abc, '3.0', '-4', or an empty string; the panic fires when a cloud writer initializes and reads this setting.","commonSituations":"Attempts to 'disable' concurrency by setting 0; decimal values copied from YAML/JSON configs; typos in automation scripts; container images with a stale invalid value baked into the environment.","solutions":["Set POLARS_UPLOAD_CONCURRENCY to a positive integer (e.g. 8) or unset it for the default","Ensure the value has no units, decimals, or surrounding whitespace","Inspect the runtime environment (`env | grep POLARS_UPLOAD_CONCURRENCY`) inside the actual process context (container/CI), not just your shell"],"exampleFix":"// before\nexport POLARS_UPLOAD_CONCURRENCY=0\n// after\nexport POLARS_UPLOAD_CONCURRENCY=8","handlingStrategy":"validation","validationCode":"const v = process.env.POLARS_UPLOAD_CONCURRENCY;\nif (v !== undefined && !/^[0-9]+$/.test(v.trim())) throw new Error(`POLARS_UPLOAD_CONCURRENCY must be a positive integer, got: ${v}`);","typeGuard":"function isValidConcurrency(v) { return typeof v === 'string' && /^[1-9][0-9]*$/.test(v.trim()); }","tryCatchPattern":"// pre-launch validation; panics abort the process so catch-and-fix the env\nif (!isValidConcurrency(process.env.POLARS_UPLOAD_CONCURRENCY ?? '1')) { console.error('POLARS_UPLOAD_CONCURRENCY must be >= 1 integer'); process.exit(2); }","preventionTips":["Never set 0 to 'disable' concurrency - unset instead","Validate env in entrypoint scripts","Match the exact variable name (upload vs partitioned upload)","Document accepted formats in team runbooks"],"tags":["env-var","configuration","panic","concurrency"],"backgroundTag":"invalid-env-var-value","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}