{"record":{"id":"d5d797686ddf578b","repo":"pola-rs/polars","slug":"invalid-value-for-polars-inflight-init-byte-budget","errorCode":null,"errorMessage":"invalid value for POLARS_INFLIGHT_INIT_BYTE_BUDGET: {x}","messagePattern":"invalid value for POLARS_INFLIGHT_INIT_BYTE_BUDGET: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-io/src/cloud/concurrency/mod.rs","lineNumber":108,"sourceCode":"            // Must be >=larger than target_chunk_size to avoid potential deadlock.\n            floor_byte_budget: target_chunk_size,\n\n            // Count-based budget.\n            request_budget: get_request_budget(),\n            floor_request_budget: get_floor_request_budget(),\n            control_interval: Duration::from_millis(100),\n            budget_resize_threshold: 0.05,\n        }\n    }\n}\n\n/// Max number of bytes concurrently in flight during the init and start of rampup phase.\nfn get_init_byte_budget(target_chunk_size: u64) -> u64 {\n    let init_byte_budget = std::env::var(\"POLARS_INFLIGHT_INIT_BYTE_BUDGET\")\n        .map(|x| {\n            x.parse::<NonZeroU64>()\n                .unwrap_or_else(|_| {\n                    panic!(\"invalid value for POLARS_INFLIGHT_INIT_BYTE_BUDGET: {x}\")\n                })\n                .get()\n        })\n        .unwrap_or_else(|_| {\n            // This should be lower than the expected BDP so it can ramp-up, but\n            // too low a value delays the transition to stable.\n            // Heuristic: higher bandwidth is expected on larger instances.\n            let n = polars_config::config().max_threads() as u64;\n            n.div_ceil(8).max(4) * target_chunk_size\n        })\n        .max(1);\n\n    if init_byte_budget < target_chunk_size {\n        panic!(\"in-flight byte budget init must be larger than the target_chunk_size\");\n    }\n\n    init_byte_budget\n}","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/crates/polars-io/src/cloud/concurrency/mod.rs#L90-L126","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set POLARS_INFLIGHT_INIT_BYTE_BUDGET to a valid positive integer (bytes).","Unset the variable to use the default initial in-flight byte budget."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"68506541d2de983056c9eb244e1ea05fab377dfc","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}