{"record":{"id":"f22edb094ed8bc2e","repo":"pola-rs/polars","slug":"cannot-combine-snapshot-id-with-from-snapshot-i","errorCode":null,"errorMessage":"cannot combine `snapshot_id` with `from_snapshot_id_exclusive` or `to_snapshot_id_inclusive`","messagePattern":"cannot combine `snapshot_id` with `from_snapshot_id_exclusive` or `to_snapshot_id_inclusive`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/iceberg/functions.py","lineNumber":213,"sourceCode":"\n    if reader_override is not None:\n        msg = \"the `reader_override` parameter of `scan_iceberg()` is considered unstable.\"\n        issue_unstable_warning(msg)\n\n    if fast_deletion_count is not None:\n        msg = \"the `fast_deletion_count` parameter of `scan_iceberg()` is considered unstable.\"\n        issue_unstable_warning(msg)\n    else:\n        fast_deletion_count = False\n\n    if snapshot_id is not None and (\n        from_snapshot_id_exclusive is not None or to_snapshot_id_inclusive is not None\n    ):\n        msg = (\n            \"cannot combine `snapshot_id` with `from_snapshot_id_exclusive` \"\n            \"or `to_snapshot_id_inclusive`\"\n        )\n        raise ValueError(msg)\n\n    table: pyiceberg.table.Table | None = None\n\n    if importlib.util.find_spec(\"pyiceberg.table\") is not None:\n        import pyiceberg.table\n\n        if isinstance(source, pyiceberg.table.Table):\n            table = source\n\n    table_descriptor_ = None\n\n    if table is None:\n        source = str(source)\n        table_descriptor_ = (\n            source  # Inferred as static metadata path\n            if \"/\" in source or \"\\\\\" in source\n            else IcebergCatalogTableDescriptor(\n                table_identifier=source,","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/iceberg/functions.py#L195-L231","documentation":"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.","triggerScenarios":"Calling `pl.scan_iceberg(..., snapshot_id=X, from_snapshot_id_exclusive=Y)` or with `to_snapshot_id_inclusive` set alongside `snapshot_id`.","commonSituations":"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.","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"],"exampleFix":"// before\npl.scan_iceberg(src, snapshot_id=sid, to_snapshot_id_inclusive=tid)\n// after\npl.scan_iceberg(src, from_snapshot_id_exclusive=sid, to_snapshot_id_inclusive=tid)","handlingStrategy":"validation","validationCode":"def check_snapshot_args(snapshot_id, from_excl, to_incl):\n    if snapshot_id is not None and (from_excl is not None or to_incl is not None):\n        raise ValueError('pass either snapshot_id or a snapshot range, not both')","typeGuard":null,"tryCatchPattern":"try:\n    lf = pl.scan_iceberg(src, snapshot_id=sid, to_snapshot_id_inclusive=tid)\nexcept ValueError as e:\n    if 'cannot combine' in str(e):\n        lf = pl.scan_iceberg(src, snapshot_id=sid)","preventionTips":["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"],"tags":["iceberg","scan","snapshot","conflicting-arguments"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}