pola-rs/polars · error · ValueError
cannot combine `snapshot_id` with…
Error message
cannot combine `snapshot_id` with `from_snapshot_id_exclusive` or `to_snapshot_id_inclusive`
What it means
scan_iceberg accepts either a single `snapshot_id` (pin the table to one snapshot) or a snapshot range via `from_snapshot_id_exclusive`/`to_snapshot_id_inclusive` (incremental scanning). Passing `snapshot_id` together with either range bound is ambiguous and rejected with this ValueError before any table load occurs.
Solutions
- Remove `snapshot_id` and use only the range parameters for incremental scans
- Remove the range parameters and keep `snapshot_id` for a pinned-snapshot read
- In wrappers, forward exactly one of the two groups based on what the caller provides
Example fix
// before pl.scan_iceberg(src, snapshot_id=sid, to_snapshot_id_inclusive=tid) // after pl.scan_iceberg(src, from_snapshot_id_exclusive=sid, to_snapshot_id_inclusive=tid)
Defensive patterns
Strategy: validation
Validate before calling
def check_snapshot_args(snapshot_id, from_excl, to_incl):
if snapshot_id is not None and (from_excl is not None or to_incl is not None):
raise ValueError('pass either snapshot_id or a snapshot range, not both') Try / catch
try:
lf = pl.scan_iceberg(src, snapshot_id=sid, to_snapshot_id_inclusive=tid)
except ValueError as e:
if 'cannot combine' in str(e):
lf = pl.scan_iceberg(src, snapshot_id=sid) Prevention
- Pass exactly one of snapshot_id or the range parameters
- In wrappers, conditionally forward snapshot args, never all at once
- Read the scan_iceberg signature to see the mutually exclusive groups
- Validate kwargs before forwarding in generic table-scan helpers
When it happens
Trigger: Calling `pl.scan_iceberg(..., snapshot_id=X, from_snapshot_id_exclusive=Y)` or with `to_snapshot_id_inclusive` set alongside `snapshot_id`.
Common situations: Merging code paths that did a pinned-snapshot read with new incremental-range parameters; copy-paste adding range args while forgetting to remove snapshot_id; building a wrapper that forwards all optional params unconditionally.
Related errors
- iceberg snapshot ID not found
- iceberg snapshot ID not found
- IcebergScanResolver: requested snapshot
- IcebergScanResolver: requested snapshot
- Cannot infer partition value from Parquet metadata for…
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/f22edb094ed8bc2e.
Report an issue: GitHub.
Appendix: source
Thrown at py-polars/src/polars/io/iceberg/functions.py:213
if reader_override is not None:
msg = "the `reader_override` parameter of `scan_iceberg()` is considered unstable."
issue_unstable_warning(msg)
if fast_deletion_count is not None:
msg = "the `fast_deletion_count` parameter of `scan_iceberg()` is considered unstable."
issue_unstable_warning(msg)
else:
fast_deletion_count = False
if snapshot_id is not None and (
from_snapshot_id_exclusive is not None or to_snapshot_id_inclusive is not None
):
msg = (
"cannot combine `snapshot_id` with `from_snapshot_id_exclusive` "
"or `to_snapshot_id_inclusive`"
)
raise ValueError(msg)
table: pyiceberg.table.Table | None = None
if importlib.util.find_spec("pyiceberg.table") is not None:
import pyiceberg.table
if isinstance(source, pyiceberg.table.Table):
table = source
table_descriptor_ = None
if table is None:
source = str(source)
table_descriptor_ = (
source # Inferred as static metadata path
if "/" in source or "\\" in source
else IcebergCatalogTableDescriptor(
table_identifier=source,View on GitHub (pinned to fe841f959e)