pola-rs/polars · error

invalid value for POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE: {s}

Error message

invalid value for POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE: {s}

What it means

Panics in env_partitioned_upload_chunk_size() when POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE is set to a value that does not parse as a NonZeroUsize. It is a startup-time env validation guard for the partitioned-upload part size; leaving the variable unset is fine.

Source

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

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

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

View on GitHub (pinned to 9b5d73fd00)

Solutions

  1. Set POLARS_PARTITIONED_UPLOAD_CHUNK_SIZE to a valid positive integer (bytes).
  2. Unset the variable to use the default partitioned 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_PARTITIONED_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_PARTITIONED_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/bc746701521ac497. Report an issue: GitHub.