pola-rs/polars · error · ValueError

`include_file_paths` cannot be used with `use_pyarrow=True`

Error message

`include_file_paths` cannot be used with `use_pyarrow=True`

What it means

The include_file_paths option (which adds a column recording the source file per row) is implemented only in Polars' native parquet reader. With use_pyarrow=True the read is dispatched to pyarrow, so this option cannot be provided and is rejected with a ValueError.

Solutions

  1. Remove include_file_paths when using use_pyarrow=True
  2. Drop use_pyarrow=True so the native reader can add the file-path column
  3. Post-process: read via pyarrow, then add the column manually with pl.lit(filename).alias('path')

Example fix

// before
pl.read_parquet(['a.parquet','b.parquet'], use_pyarrow=True, include_file_paths='path')
// after
pl.read_parquet(['a.parquet','b.parquet'], include_file_paths='path')
Defensive patterns

Strategy: validation

Validate before calling

if use_pyarrow and include_file_paths is not None:
    raise ValueError('include_file_paths cannot be used with use_pyarrow=True')

Prevention

When it happens

Trigger: pl.read_parquet(..., use_pyarrow=True, include_file_paths='path') — any non-None include_file_paths with use_pyarrow=True.

Common situations: Multi-file/hive reads where users want provenance columns while also forcing the pyarrow backend; enabling pyarrow dispatch for speed while keeping native-reader metadata features.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/a36e30970fc2112b. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/io/parquet/functions.py:248

    del row_index_name
    del row_index_offset

    if schema is not None:
        msg = "the `schema` parameter of `read_parquet` is considered unstable."
        issue_unstable_warning(msg)

    if hive_schema is not None:
        msg = "the `hive_schema` parameter of `read_parquet` is considered unstable."
        issue_unstable_warning(msg)

    # Dispatch to pyarrow if requested
    if use_pyarrow:
        if n_rows is not None:
            msg = "`n_rows` cannot be used with `use_pyarrow=True`"
            raise ValueError(msg)
        if include_file_paths is not None:
            msg = "`include_file_paths` cannot be used with `use_pyarrow=True`"
            raise ValueError(msg)
        if schema is not None:
            msg = "`schema` cannot be used with `use_pyarrow=True`"
            raise ValueError(msg)
        if hive_schema is not None:
            msg = (
                "cannot use `hive_partitions` with `use_pyarrow=True`"
                "\n\nHint: Pass `pyarrow_options` instead with a 'partitioning' entry."
            )
            raise TypeError(msg)

        df = _read_parquet_with_pyarrow(
            source,
            columns=columns,
            storage_options=storage_options,
            pyarrow_options=pyarrow_options,
            memory_map=memory_map,
        )

View on GitHub (pinned to fe841f959e)