pola-rs/polars · error
invalid value for POLARS_INFLIGHT_REQUEST_BUDGET
Error message
invalid value for POLARS_INFLIGHT_REQUEST_BUDGET: {x} What it means
Polars parses POLARS_INFLIGHT_REQUEST_BUDGET as a NonZeroU64 to cap concurrent requests in the cloud download pipeline (default 512). If the variable is set but is not a valid non-zero integer, the library panics with this message. The fail-fast panic prevents silently running with a mis-sized connection pool.
Solutions
- Set the variable to a plain positive decimal integer, e.g. 512.
- Unset the variable to fall back to the default of 512.
- Inspect the raw value with `env | grep POLARS_INFLIGHT_REQUEST_BUDGET | cat -A` to reveal hidden characters.
- Validate with a quick parse before launching, e.g. python -c "int('${VAL}')" or shell case guard.
Example fix
// before export POLARS_INFLIGHT_REQUEST_BUDGET=1,024 // after export POLARS_INFLIGHT_REQUEST_BUDGET=1024
Defensive patterns
Strategy: validation
Validate before calling
const v = process.env.POLARS_INFLIGHT_REQUEST_BUDGET;
if (v !== undefined && (!/^[1-9]\d*$/.test(v.trim()) || BigInt(v) > 18446744073709551615n)) {
throw new Error(`POLARS_INFLIGHT_REQUEST_BUDGET must be a positive integer, got: ${JSON.stringify(v)}`);
} Type guard
const isValidRequestBudget = (v) => typeof v === 'string' && /^[1-9]\d*$/.test(v.trim());
Prevention
- Use plain decimal digits only — no separators, units, or whitespace.
- Log the exact value (JSON.stringify) to catch hidden spaces/newlines in manifests.
- Unset rather than zero-out when you want defaults.
When it happens
Trigger: Setting POLARS_INFLIGHT_REQUEST_BUDGET to a non-numeric value ('unlimited', '512 '), zero, a negative number, or a value beyond u64 range; called at initialization via get_request_budget / set_execution_state.
Common situations: Ops teams setting '512' with a trailing space or newline in Kubernetes manifests; using '0' intending to disable in-flight limits; pasting values with thousands separators like '1,024'.
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
- in-flight byte budget init must be larger than the…
- integer
- invalid value for POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET
- invalid value for POLARS_INFLIGHT_INIT_BYTE_BUDGET
- invalid value for
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/a6f5177b8e9f5e27.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-io/src/cloud/concurrency/mod.rs:137
.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
}
/// Maximum number of requests concurrently in flight.
pub fn get_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_REQUEST_BUDGET")
.map(|x| {
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}")
})View on GitHub (pinned to fe841f959e)