{"record":{"id":"6712e0bb48b6a6c8","repo":"pola-rs/polars","slug":"polars-no-fast-file-count-must-be-one-of-0-1","errorCode":null,"errorMessage":"POLARS_NO_FAST_FILE_COUNT must be one of ('0', '1'), got: {v}","messagePattern":"POLARS_NO_FAST_FILE_COUNT must be one of \\('0', '1'\\), got: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs","lineNumber":1655,"sourceCode":"                // New-streaming is generally on par for all except CSV (see https://github.com/pola-rs/polars/pull/22363).\n                // In the future we can potentially remove the dedicated count codepaths.\n                #[cfg(feature = \"csv\")]\n                if out_edge.projection() == Projection::Len\n                    && let FileScanIR::Csv { .. } = scan_type.as_ref()\n                    && unified_scan_args.pre_slice.is_none()\n                    && (predicate.is_none()\n                        || matches!(\n                            predicate_file_skip_applied,\n                            Some(PredicateFileSkip {\n                                no_residual_predicate: true,\n                                ..\n                            })\n                        ))\n                    && (match std::env::var(\"POLARS_NO_FAST_FILE_COUNT\").as_deref() {\n                        Ok(\"0\") | Err(_) => true,\n                        Ok(\"1\") => false,\n                        Ok(v) => {\n                            panic!(\"POLARS_NO_FAST_FILE_COUNT must be one of ('0', '1'), got: {v}\")\n                        },\n                    })\n                    && let Some(name) = extract_select_len_expr(parent_ir, self.expr_arena)\n                        .map(|e| e.output_name().clone())\n                {\n                    // Replace the scan with empty DF scan as input to the MapFunction.\n                    let dummy_ir = IR::DataFrameScan {\n                        df: Arc::new(Default::default()),\n                        schema: Arc::new(Default::default()),\n                        output_schema: None,\n                    };\n\n                    let IR::Scan {\n                        sources,\n                        scan_type,\n                        unified_scan_args,\n                        ..\n                    } = storage.replace(key, dummy_ir)","sourceCodeStart":1637,"sourceCodeEnd":1673,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/crates/polars-plan/src/plans/optimizer/projection_pushdown/mod.rs#L1637-L1673","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set POLARS_NO_FAST_FILE_COUNT to either '0' or '1'.","Unset the variable to use the default fast file count behavior."],"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-14T00:17:10.932Z"}