pola-rs/polars · error

invalid value for POLARS_PARTITIONED_UPLOAD_CONCURRENCY: {s}

Error message

invalid value for POLARS_PARTITIONED_UPLOAD_CONCURRENCY: {s}

What it means

Raised in env_partitioned_upload_concurrency() when POLARS_PARTITIONED_UPLOAD_CONCURRENCY is set to a string that does not parse as a NonZeroUsize. It is an env-var parse guard for the number of concurrent tasks allowed in a partitioned cloud writer.

Source

Thrown at crates/polars-io/src/configs.rs:34

                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}"))
    })
}

pub fn env_partitioned_upload_concurrency() -> Option<NonZeroUsize> {
    std::env::var("POLARS_PARTITIONED_UPLOAD_CONCURRENCY")
        .ok()
        .map(|s| {
            s.parse::<NonZeroUsize>().unwrap_or_else(|_| {
                panic!("invalid value for POLARS_PARTITIONED_UPLOAD_CONCURRENCY: {s}")
            })
        })
}

/// Runs of this many values whose total bytes are <= `copy_buffer_reserve_size` will be copied into
/// a single contiguous chunk.
pub(crate) fn cloud_writer_coalesce_run_length() -> usize {
    return *COALESCE_RUN_LENGTH;

    static COALESCE_RUN_LENGTH: LazyLock<usize> = LazyLock::new(|| {
        let mut v: usize = 64;

        if let Ok(s) = std::env::var("POLARS_CLOUD_WRITER_COALESCE_RUN_LENGTH") {
            v = s
                .parse::<usize>()
                .ok()
                .filter(|x| *x >= 2)
                .unwrap_or_else(|| {

View on GitHub (pinned to 9b5d73fd00)

Solutions

  1. Set POLARS_PARTITIONED_UPLOAD_CONCURRENCY to a valid positive integer.
  2. Unset the variable to use the default partitioned upload concurrency.
Defensive patterns

Strategy: validation

When it happens

Trigger: This panic/expect fires when execution reaches an unguarded state described by: "invalid value for POLARS_PARTITIONED_UPLOAD_CONCURRENCY: {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_PARTITIONED_UPLOAD_CONCURRENCY: {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/05ac03f8bc07af9b. Report an issue: GitHub.