pola-rs/polars · error
invalid value for POLARS_INFLIGHT_INIT_BYTE_BUDGET
Error message
invalid value for POLARS_INFLIGHT_INIT_BYTE_BUDGET: {x} What it means
Polars parses the POLARS_INFLIGHT_INIT_BYTE_BUDGET environment variable as a NonZeroU64 to size the byte budget kept in flight during the init/ramp-up phase of cloud downloads. If the variable is set but cannot be parsed as a non-zero 64-bit integer, the library panics with this message. It is a fail-fast configuration guard, not a recoverable runtime failure.
Solutions
- Set POLARS_INFLIGHT_INIT_BYTE_BUDGET to a plain positive integer without units, e.g. 134217728 (not 128M).
- Unset the variable entirely (env::remove_var / unset in shell) to use the computed default (max_threads/8, min 4, times target chunk size).
- Check the value with `echo "$POLARS_INFLIGHT_INIT_BYTE_BUDGET"` and `env | grep POLARS` for stray whitespace, quotes, or carriage returns.
- If a wrapper script sets it, guard with a numeric check before export.
Example fix
// before export POLARS_INFLIGHT_INIT_BYTE_BUDGET=128M // after export POLARS_INFLIGHT_INIT_BYTE_BUDGET=134217728
Defensive patterns
Strategy: validation
Validate before calling
const v = process.env.POLARS_INFLIGHT_INIT_BYTE_BUDGET;
if (v !== undefined && (!/^\d+$/.test(v.trim()) || BigInt(v) === 0n || BigInt(v) > 18446744073709551615n)) {
throw new Error(`POLARS_INFLIGHT_INIT_BYTE_BUDGET must be a non-zero u64, got: ${v}`);
} Type guard
const isValidBudget = (v) => typeof v === 'string' && /^\d+$/.test(v.trim()) && BigInt(v) > 0n && BigInt(v) <= 18446744073709551615n;
Prevention
- Never use unit suffixes (K/M/G) in POLARS_* numeric env vars — raw byte counts only.
- Never set these variables to 0; omit them for defaults.
- Add an entrypoint script check that validates all POLARS_ numeric vars at container start.
When it happens
Trigger: Setting POLARS_INFLIGHT_INIT_BYTE_BUDGET to a value that fails NonZeroU64::parse: empty string, non-numeric text ('64MB', 'auto'), zero ('0'), negative numbers ('-5'), or a number exceeding u64 range.
Common situations: Copy-pasting a unit-suffixed value like '128M' from documentation; setting the variable to '0' intending 'unlimited'; shell quoting mistakes leaving whitespace or quotes in the value; setting it in a Dockerfile or CI for a different Polars version.
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_REQUEST_BUDGET
- invalid value for
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/d5d797686ddf578b.
Report an issue: GitHub.
Appendix: 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 fe841f959e)