pola-rs/polars · error

invalid value for POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET

Error message

invalid value for POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET: {x}

What it means

Polars parses POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET as a NonZeroU64 to set the minimum number of concurrent requests maintained during adaptive pacing (default: max_threads). A set-but-unparseable value triggers this panic at initialization. It is a strict configuration validation to avoid a floor of zero requests.

Solutions

  1. Set the variable to a plain positive integer, e.g. 8 (not 8.0).
  2. Unset it to use the default derived from Polars max_threads configuration.
  3. Strip whitespace/quotes in the originating template or entrypoint script before export.
  4. Check that no earlier process in the container chain exports a bad value (`env` in the failing process).

Example fix

// before
export POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET=8.0
// after
export POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET=8
Defensive patterns

Strategy: validation

Validate before calling

const v = process.env.POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET;
if (v !== undefined && (!/^[1-9]\d*$/.test(v.trim()) || BigInt(v) > 18446744073709551615n)) {
  throw new Error(`POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET must be a positive integer, got: ${JSON.stringify(v)}`);
}

Type guard

const isValidFloorBudget = (v) => typeof v === 'string' && /^[1-9]\d*$/.test(v.trim());

Prevention

When it happens

Trigger: Setting POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET to anything NonZeroU64 cannot parse: 'auto', '8.0', '0', negative values, empty string, or values overflowing u64.

Common situations: Treating the value as a float ('8.0') when tuning concurrency; zeroing it hoping to pause downloads; locale or whitespace contamination when generated by templating tools like Helm or envsubst.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/e5e2eb9da1c5dd8a. Report an issue: GitHub.

Appendix: source

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

            x.parse::<NonZeroU64>()
                .unwrap_or_else(|_| panic!("invalid value for POLARS_INFLIGHT_REQUEST_BUDGET: {x}"))
                .get()
        })
        .unwrap_or(512)
        .max(1)
}

/// Minimum number of requests concurrently in flight, if demand is there.
pub fn get_floor_request_budget() -> u64 {
    // Since object_store/reqwest use HTTP/1 with a connection pool, this value controls the
    // max concurrent TCP sessions to S3 for the pipeline.
    // When modifying this value, consider the max_thread count configuration(s), the OS limitations
    // (e.g., ulimit -n), and any cloud infrastructure limitations.
    std::env::var("POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET")
        .map(|x| {
            x.parse::<NonZeroU64>()
                .unwrap_or_else(|_| {
                    panic!("invalid value for POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET: {x}")
                })
                .get()
        })
        .unwrap_or(polars_config::config().max_threads() as u64)
        .max(1)
}

/// Windowed round-trip time of 0-byte metadata (HEAD) requests.
/// Diagnostic only, not to be used for BDP estimation.
#[derive(Debug)]
pub struct HeadRttChannel {
    min_ns: AtomicU64,
    sum_ns: AtomicU64,
    count: AtomicU64,
    /// Never reset, unlike `count`: distinguishes the first request of the process from
    /// the first of a window.
    total: AtomicU64,
}

View on GitHub (pinned to fe841f959e)