{"record":{"id":"bc746701521ac497","repo":"pola-rs/polars","slug":"invalid-value-for-polars-partitioned-upload-chunk","errorCode":null,"errorMessage":"invalid value for POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE: {s}","messagePattern":"invalid value for POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-io/src/configs.rs","lineNumber":16,"sourceCode":"use std::num::NonZeroUsize;\nuse std::sync::LazyLock;\n\npub fn env_upload_chunk_size() -> Option<NonZeroUsize> {\n    std::env::var(\"POLARS_UPLOAD_CHUNK_SIZE\").ok().map(|s| {\n        s.parse::<NonZeroUsize>()\n            .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}\")","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-io/src/configs.rs#L1-L34","documentation":"This panic fires when the environment variable POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE is set but does not parse as a non-zero usize. It configures the per-partition upload chunk size used by Polars' partitioned cloud writers. Since it is treated as mandatory configuration whenever present, an invalid value aborts the process rather than falling back to a default.","triggerScenarios":"export POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE=0, or any non-integer string like 'ten', '2.5', '-1', or an empty value; the panic occurs in env_partitioned_upload_chunk_size when a partitioned cloud writer reads its config.","commonSituations":"Users tuning partitioned writes to cloud storage (S3/GCS/Azure) mistyping the value; confusing this var with a byte-size var and appending units; zero value under the misconception it disables partitioning.","solutions":["Set the variable to a plain positive integer (>= 1) or remove it to use the default","Check for whitespace or invisible characters in the shell/CI environment","If you intended to change chunk size for non-partitioned writes, use POLARS_UPLOAD_CHUNK_SIZE instead"],"exampleFix":"// before\nPOLARS_PARTITIONED_UPLOAD_CHUNK_SIZE=0\n// after\nPOLARS_PARTITIONED_UPLOAD_CHUNK_SIZE=1048576","handlingStrategy":"validation","validationCode":"const v = process.env.POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE;\nif (v !== undefined && !/^[0-9]+$/.test(v.trim())) throw new Error(`POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE must be a positive integer, got: ${v}`);","typeGuard":"function isValidChunkSize(v) { return typeof v === 'string' && /^[0-9]+$/.test(v.trim()) && parseInt(v, 10) > 0; }","tryCatchPattern":"// panic is not catchable; sanitize env before spawning the process\nconst raw = process.env.POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE;\nif (raw && !/^\\d+$/.test(raw.trim())) delete process.env.POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE;","preventionTips":["Use positive integers only; no units or decimals","Remove the variable rather than setting 0","Keep partitioned and non-partitioned vars distinct in config files","Audit .env and container env for stale values"],"tags":["env-var","configuration","panic","polars"],"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"}