pola-rs/polars · error
POLARS_NO_FAST_FILE_COUNT must be one of ('0', '1'), got: {v
Error message
POLARS_NO_FAST_FILE_COUNT must be one of ('0', '1'), got: {v} What it means
Environment-variable validation in the projection-pushdown fast count optimisation: the POLARS_NO_FAST_FILE_COUNT override was set to a value other than the allowed '0' or '1'. The env var's raw value is the faulty input.
Source
Thrown at crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs:1655
// New-streaming is generally on par for all except CSV (see https://github.com/pola-rs/polars/pull/22363).
// In the future we can potentially remove the dedicated count codepaths.
#[cfg(feature = "csv")]
if out_edge.projection() == Projection::Len
&& let FileScanIR::Csv { .. } = scan_type.as_ref()
&& unified_scan_args.pre_slice.is_none()
&& (predicate.is_none()
|| matches!(
predicate_file_skip_applied,
Some(PredicateFileSkip {
no_residual_predicate: true,
..
})
))
&& (match std::env::var("POLARS_NO_FAST_FILE_COUNT").as_deref() {
Ok("0") | Err(_) => true,
Ok("1") => false,
Ok(v) => {
panic!("POLARS_NO_FAST_FILE_COUNT must be one of ('0', '1'), got: {v}")
},
})
&& let Some(name) = extract_select_len_expr(parent_ir, self.expr_arena)
.map(|e| e.output_name().clone())
{
// Replace the scan with empty DF scan as input to the MapFunction.
let dummy_ir = IR::DataFrameScan {
df: Arc::new(Default::default()),
schema: Arc::new(Default::default()),
output_schema: None,
};
let IR::Scan {
sources,
scan_type,
unified_scan_args,
..
} = storage.replace(key, dummy_ir)View on GitHub (pinned to 68506541d2)
Solutions
- Set POLARS_NO_FAST_FILE_COUNT to either '0' or '1'.
- Unset the variable to use the default fast file count behavior.
Defensive patterns
Strategy: validation
When it happens
Trigger: This panic/expect fires when execution reaches an unguarded state described by: "POLARS_NO_FAST_FILE_COUNT must be one of ('0', '1'), got: {v}". 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.
Common situations: Encountered when input data or configuration does not meet the preconditions of the throwing code path ("POLARS_NO_FAST_FILE_COUNT must be one of ('0', '1'), got: {v}"). 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.
AI-assisted analysis of pola-rs/polars@68506541d2 (2026-08-19).
Data as JSON: /api/errors/6712e0bb48b6a6c8.
Report an issue: GitHub.