pola-rs/polars · error

invalid scan args from python dataset resolve: {:?}

Error message

invalid scan args from python dataset resolve: {:?}

What it means

The python dataset-scan resolve path destructures FileScanArgs expecting an untouched pattern (projection=None, row_index=None, pre_slice=None, include_file_paths=None, hidden_file_prefix=None); if Python supplied any of these unsupported scan arguments the pattern match fails and panics naming the args. Strip unsupported options from the python-side dataset scan.

Source

Thrown at crates/polars-plan/src/plans/optimizer/expand_datasets.rs:339

                rechunk,
                cache,
                glob: _,
                hidden_file_prefix: _hidden_file_prefix @ None,
                projection: _projection @ None,
                column_mapping,
                default_values,
                row_index: _row_index @ None,
                pre_slice: _pre_slice @ None,
                cast_columns_policy,
                missing_columns_policy,
                extra_columns_policy,
                include_file_paths: _include_file_paths @ None,
                deletion_files,
                table_statistics,
                row_count,
            } = resolved_unified_scan_args.as_ref()
            else {
                panic!(
                    "invalid scan args from python dataset resolve: {:?}",
                    resolved_unified_scan_args
                )
            };

            unified_scan_args.cloud_options = cloud_options.clone();
            unified_scan_args.rechunk = *rechunk;
            unified_scan_args.cache = *cache;
            unified_scan_args.cast_columns_policy = cast_columns_policy.clone();
            unified_scan_args.missing_columns_policy = *missing_columns_policy;
            unified_scan_args.extra_columns_policy = *extra_columns_policy;
            unified_scan_args.column_mapping = column_mapping.clone();
            unified_scan_args.default_values = default_values.clone();
            unified_scan_args.deletion_files = deletion_files.clone();
            unified_scan_args.table_statistics = table_statistics.clone();
            unified_scan_args.row_count = *row_count;

            if row_index_in_live_filter {

View on GitHub (pinned to fc24390824)

Solutions

  1. The Python dataset resolve returned invalid scan arguments; check the dataset object's schema and options.
  2. Update polars/python-side dataset integration so the serialized scan args match the expected format.
Defensive patterns

Strategy: validation

When it happens

Trigger: This panic/expect fires when execution reaches an unguarded state described by: "invalid scan args from python dataset resolve: {:?}". 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 ("invalid scan args from python dataset resolve: {:?}"). 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@fc24390824 (2026-08-19). Data as JSON: /api/errors/38a3103fc0ba9efc. Report an issue: GitHub.