pola-rs/polars · error
invalid value for POLARS_INFLIGHT_SINK_MORSEL_LIMIT: {x}
Error message
invalid value for POLARS_INFLIGHT_SINK_MORSEL_LIMIT: {x} What it means
Panic from IOSinkNodeConfig::inflight_morsel_limit: the POLARS_INFLAT_SINK_MORSEL_LIMIT environment variable was set but could not be parsed as a NonZeroUsize (empty, non-numeric, or zero). The string {x} is the offending raw value.
Source
Thrown at crates/polars-stream/src/nodes/io_sinks/config.rs:33
const DEFAULT_PARTITIONED_UPLOAD_CHUNK_SIZE: NonZeroUsize =
NonZeroUsize::new(6 * 1024 * 1024).unwrap();
pub struct IOSinkNodeConfig {
pub file_format: FileWriteFormat,
pub target: IOSinkTarget,
pub unified_sink_args: UnifiedSinkArgs,
pub input_schema: SchemaRef,
}
impl IOSinkNodeConfig {
pub fn num_pipelines_per_sink(&self, num_pipelines: NonZeroUsize) -> NonZeroUsize {
NonZeroUsize::min(num_pipelines, self.inflight_morsel_limit(num_pipelines))
}
pub fn inflight_morsel_limit(&self, num_pipelines: NonZeroUsize) -> NonZeroUsize {
if let Ok(v) = std::env::var("POLARS_INFLIGHT_SINK_MORSEL_LIMIT").map(|x| {
x.parse::<NonZeroUsize>().unwrap_or_else(|_| {
panic!("invalid value for POLARS_INFLIGHT_SINK_MORSEL_LIMIT: {x}")
})
}) {
return v;
};
NonZeroUsize::saturating_add(
num_pipelines,
// Additional buffer to accommodate head-of-line blocking
4,
)
}
pub fn max_open_sinks(&self) -> NonZeroUsize {
if let Ok(v) = std::env::var("POLARS_MAX_OPEN_SINKS").map(|x| {
x.parse::<NonZeroUsize>()
.unwrap_or_else(|_| panic!("invalid value for POLARS_MAX_OPEN_SINKS: {x}"))
}) {
return v;View on GitHub (pinned to 9b5d73fd00)
Solutions
- Set POLARS_INFLIGHT_SINK_MORSEL_LIMIT to a positive integer, or unset it to use the default.
Example fix
export POLARS_INFLIGHT_SINK_MORSEL_LIMIT=16
Defensive patterns
Strategy: validation
When it happens
Trigger: Environment variable POLARS_INFLIGHT_SINK_MORSEL_LIMIT holds a non-numeric or out-of-range value.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19).
Data as JSON: /api/errors/e97708ae530a5ec5.
Report an issue: GitHub.