{"record":{"id":"a6f5177b8e9f5e27","repo":"pola-rs/polars","slug":"invalid-value-for-polars-inflight-request-budget","errorCode":null,"errorMessage":"invalid value for POLARS_INFLIGHT_REQUEST_BUDGET: {x}","messagePattern":"invalid value for POLARS_INFLIGHT_REQUEST_BUDGET: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-io/src/cloud/concurrency/mod.rs","lineNumber":137,"sourceCode":"        .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}\n\n/// Maximum number of requests concurrently in flight.\npub fn get_request_budget() -> u64 {\n    // Since object_store/reqwest use HTTP/1 with a connection pool, this value controls the\n    // max concurrent TCP sessions to S3 for the pipeline.\n    // When modifying this value, consider the max_thread count configuration(s), the OS limitations\n    // (e.g., ulimit -n), and any cloud infrastructure limitations.\n    std::env::var(\"POLARS_INFLIGHT_REQUEST_BUDGET\")\n        .map(|x| {\n            x.parse::<NonZeroU64>()\n                .unwrap_or_else(|_| panic!(\"invalid value for POLARS_INFLIGHT_REQUEST_BUDGET: {x}\"))\n                .get()\n        })\n        .unwrap_or(512)\n        .max(1)\n}\n\n/// Minimum number of requests concurrently in flight, if demand is there.\npub fn get_floor_request_budget() -> u64 {\n    // Since object_store/reqwest use HTTP/1 with a connection pool, this value controls the\n    // max concurrent TCP sessions to S3 for the pipeline.\n    // When modifying this value, consider the max_thread count configuration(s), the OS limitations\n    // (e.g., ulimit -n), and any cloud infrastructure limitations.\n    std::env::var(\"POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET\")\n        .map(|x| {\n            x.parse::<NonZeroU64>()\n                .unwrap_or_else(|_| {\n                    panic!(\"invalid value for POLARS_INFLIGHT_FLOOR_REQUEST_BUDGET: {x}\")\n                })","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-io/src/cloud/concurrency/mod.rs#L119-L155","documentation":"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.","triggerScenarios":"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.","commonSituations":"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'.","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."],"exampleFix":"// before\nexport POLARS_INFLIGHT_REQUEST_BUDGET=1,024\n// after\nexport POLARS_INFLIGHT_REQUEST_BUDGET=1024","handlingStrategy":"validation","validationCode":"const v = process.env.POLARS_INFLIGHT_REQUEST_BUDGET;\nif (v !== undefined && (!/^[1-9]\\d*$/.test(v.trim()) || BigInt(v) > 18446744073709551615n)) {\n  throw new Error(`POLARS_INFLIGHT_REQUEST_BUDGET must be a positive integer, got: ${JSON.stringify(v)}`);\n}","typeGuard":"const isValidRequestBudget = (v) => typeof v === 'string' && /^[1-9]\\d*$/.test(v.trim());","tryCatchPattern":null,"preventionTips":["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."],"tags":["rust","env-var","configuration","panic","cloud-io"],"backgroundTag":"invalid-env-var-value","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}