pola-rs/polars · error

invalid value for POLARS_INFLIGHT_INIT_BYTE_BUDGET: {x}

Error message

invalid value for POLARS_INFLIGHT_INIT_BYTE_BUDGET: {x}

What it means

Panics in get_init_byte_budget() when POLARS_INFLIGHT_INIT_BYTE_BUDGET is set to a string that does not parse as u64. This budget seeds the in-flight byte limiter during init/rampup; the panic occurs strictly at env-var parse time when the variable holds a non-numeric value.

Source

Thrown at crates/polars-io/src/cloud/concurrency/mod.rs:108

            // Must be >=larger than target_chunk_size to avoid potential deadlock.
            floor_byte_budget: target_chunk_size,

            // Count-based budget.
            request_budget: get_request_budget(),
            floor_request_budget: get_floor_request_budget(),
            control_interval: Duration::from_millis(100),
            budget_resize_threshold: 0.05,
        }
    }
}

/// Max number of bytes concurrently in flight during the init and start of rampup phase.
fn get_init_byte_budget(target_chunk_size: u64) -> u64 {
    let init_byte_budget = std::env::var("POLARS_INFLIGHT_INIT_BYTE_BUDGET")
        .map(|x| {
            x.parse::<NonZeroU64>()
                .unwrap_or_else(|_| {
                    panic!("invalid value for POLARS_INFLIGHT_INIT_BYTE_BUDGET: {x}")
                })
                .get()
        })
        .unwrap_or_else(|_| {
            // This should be lower than the expected BDP so it can ramp-up, but
            // too low a value delays the transition to stable.
            // Heuristic: higher bandwidth is expected on larger instances.
            let n = polars_config::config().max_threads() as u64;
            n.div_ceil(8).max(4) * target_chunk_size
        })
        .max(1);

    if init_byte_budget < target_chunk_size {
        panic!("in-flight byte budget init must be larger than the target_chunk_size");
    }

    init_byte_budget
}

View on GitHub (pinned to 68506541d2)

Solutions

  1. Set POLARS_INFLIGHT_INIT_BYTE_BUDGET to a valid positive integer (bytes).
  2. Unset the variable to use the default initial in-flight byte budget.
Defensive patterns

Strategy: validation

When it happens

Trigger: This panic/expect fires when execution reaches an unguarded state described by: "invalid value for POLARS_INFLIGHT_INIT_BYTE_BUDGET: {x}". 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_INFLIGHT_INIT_BYTE_BUDGET: {x}"). 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@68506541d2 (2026-08-19). Data as JSON: /api/errors/d5d797686ddf578b. Report an issue: GitHub.