pola-rs/polars · error
invalid value for POLARS_UPLOAD_CHUNK_SIZE: {s}
Error message
invalid value for POLARS_UPLOAD_CHUNK_SIZE: {s} What it means
Panics in env_upload_chunk_size() when POLARS_UPLOAD_CHUNK_SIZE is set but does not parse as a NonZeroUsize (e.g. '0', '-1', or non-numeric text). The chunk size governs multipart upload part sizing; unset or valid values never trigger this.
Source
Thrown at crates/polars-io/src/configs.rs:7
use std::num::NonZeroUsize;
use std::sync::LazyLock;
pub fn env_upload_chunk_size() -> Option<NonZeroUsize> {
std::env::var("POLARS_UPLOAD_CHUNK_SIZE").ok().map(|s| {
s.parse::<NonZeroUsize>()
.unwrap_or_else(|_| panic!("invalid value for POLARS_UPLOAD_CHUNK_SIZE: {s}"))
})
}
pub fn env_partitioned_upload_chunk_size() -> Option<NonZeroUsize> {
std::env::var("POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE")
.ok()
.map(|s| {
s.parse::<NonZeroUsize>().unwrap_or_else(|_| {
panic!("invalid value for POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE: {s}")
})
})
}
/// Max concurrent tasks within a single cloud writer.
pub fn env_upload_concurrency() -> Option<NonZeroUsize> {
std::env::var("POLARS_UPLOAD_CONCURRENCY").ok().map(|s| {
s.parse::<NonZeroUsize>()
.unwrap_or_else(|_| panic!("invalid value for POLARS_UPLOAD_CONCURRENCY: {s}"))View on GitHub (pinned to 9b5d73fd00)
Solutions
- Set POLARS_UPLOAD_CHUNK_SIZE to a valid positive integer (bytes).
- Unset the variable to use the default upload chunk size.
Defensive patterns
Strategy: validation
When it happens
Trigger: This panic/expect fires when execution reaches an unguarded state described by: "invalid value for POLARS_UPLOAD_CHUNK_SIZE: {s}". Typical triggers: unsupported dtype or feature-gated code path reached at runtime, invalid user input or environment variable value, calling API methods in the wrong order or on mismatched types, or data (lengths, offsets, ranges) violating the function's preconditions.
Common situations: Encountered when input data or configuration does not meet the preconditions of the throwing code path ("invalid value for POLARS_UPLOAD_CHUNK_SIZE: {s}"). Common cases: missing Cargo feature flags, mismatched dtypes/lengths between arrays or series, out-of-range temporal values, malformed environment variables, or operations on unsupported/complex nested types.
AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19).
Data as JSON: /api/errors/d1e0c3f1265fc2e2.
Report an issue: GitHub.