pola-rs/polars · error · ValueError

` ` is not supported by the remote engine

Error message

`{name}` is not supported by the remote engine

What it means

_reject_if_set scans keyword options passed to remote collect/sink calls and raises ValueError for any option set to a truthy value, because Polars Cloud does not support it. The offending option name is interpolated into the message.

Solutions

  1. Remove or set the named option to falsy for remote runs.
  2. Branch on engine type: pass the option only for local engines.
  3. Check the polars-cloud docs for the supported option subset of collect/sink_*.

Example fix

// before
lf.sink_parquet(uri, engine=remote_engine, maintain_order=True)

// after
lf.sink_parquet(uri, engine=remote_engine)
Defensive patterns

Strategy: validation

Validate before calling

UNSUPPORTED_REMOTE = {'maintain_order'}  # plus any flags your wrapper forwards
bad = {k: v for k, v in options.items() if k in UNSUPPORTED_REMOTE and v}
if bad:
    raise ValueError(f'options unsupported by remote engine: {sorted(bad)}')

Type guard

def remote_safe_options(options: dict) -> dict:
    return {k: v for k, v in options.items() if not v or k not in UNSUPPORTED_REMOTE}

Try / catch

try:
    lf.collect(engine=remote_engine, **options)
except ValueError as e:
    if 'is not supported by the remote engine' in str(e):
        lf.collect(engine=remote_engine)
    else:
        raise

Prevention

When it happens

Trigger: Calling lf.collect(engine=RemoteEngine(...), optimization-related flags like unify_schemas=True/parallel=True-style kwargs), or sink_parquet/sink_ipc/sink_csv with unsupported options (e.g. maintain_order=True) that the remote engine rejects.

Common situations: Generic wrapper functions that always forward all options to collect/sink; switching an existing local pipeline to the remote engine without pruning options.

Related errors


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

Appendix: source

Thrown at py-polars/src/polars/lazyframe/engine_remote.py:235

    def _sink_uri(path: Any) -> str | PartitionBy:
        """Validate a Polars Cloud sink target."""
        from polars.io.partition import PartitionBy

        if not isinstance(path, (str, PartitionBy)):
            msg = (
                "the remote engine can only sink to a URI or a `PartitionBy`, got "
                f"{qualified_type_name(path)!r}"
            )
            raise TypeError(msg)
        return path

    @staticmethod
    def _reject_if_set(**kwargs: Any) -> None:
        """Reject options unsupported by Polars Cloud."""
        for name, value in kwargs.items():
            if value:
                msg = f"`{name}` is not supported by the remote engine"
                raise ValueError(msg)

    def sink_parquet(
        self,
        lf: LazyFrame,
        path: str | Path | IO[bytes] | PartitionBy,
        *,
        compression: ParquetCompression,
        compression_level: int | None,
        statistics: bool | str | dict[str, bool],
        row_group_size: int | None,
        data_page_size: int | None,
        maintain_order: bool,
        storage_options: StorageOptionsDict | None,
        credential_provider: CredentialProviderFunction | Literal["auto"] | None,
        sync_on_close: SyncOnCloseMethod | None,
        metadata: ParquetMetadata | None,
        arrow_schema: ArrowSchemaExportable | None,
        mkdir: bool,

View on GitHub (pinned to fe841f959e)