apache/iceberg · error · UnsupportedOperationException

Transaction tables do not support managing snapshots

Error message

Transaction tables do not support managing snapshots

What it means

The TransactionTable inside an open transaction does not support the ManageSnapshots API, because snapshot management (rollback, cherrypick, branch/tag creation) is itself implemented as a transaction-level operation and cannot nest inside an existing transaction. Calling manageSnapshots() throws UnsupportedOperationException immediately.

Solutions

  1. Perform snapshot management on the outer Table directly: table.manageSnapshots().rollbackTo(id).commit()
  2. Sequence operations: commit the current transaction first, then manage snapshots
  3. Refactor generic code to distinguish transaction tables from base tables

Example fix

// before
Transaction tx = table.newTransaction();
tx.table().manageSnapshots().rollbackTo(oldSnapshot).commit(); // throws
// after
tx.commitTransaction(); // finish current work first
table.manageSnapshots().rollbackTo(oldSnapshot).commit();
Defensive patterns

Strategy: validation

Validate before calling

if (isTransactionTable(table)) { throw new IllegalStateException("manageSnapshots must be called on the base table"); }

Try / catch

catch (UnsupportedOperationException e) { outerTable.manageSnapshots()...commit(); }

Prevention

When it happens

Trigger: Calling transaction.table().manageSnapshots() or any of its methods (rollbackTo, cherrypick, setCurrentSnapshot, createBranch) while inside table.newTransaction().

Common situations: Attempting rollback or branch creation as part of a larger write transaction; generic framework code that calls manageSnapshots() on any Table handle it receives.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/751c22cf9d6d57f8. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/apache/iceberg/BaseTransaction.java:684

    @Override
    public UpdateStatistics updateStatistics() {
      return BaseTransaction.this.updateStatistics();
    }

    @Override
    public UpdatePartitionStatistics updatePartitionStatistics() {
      return BaseTransaction.this.updatePartitionStatistics();
    }

    @Override
    public ExpireSnapshots expireSnapshots() {
      return BaseTransaction.this.expireSnapshots();
    }

    @Override
    public ManageSnapshots manageSnapshots() {
      throw new UnsupportedOperationException(
          "Transaction tables do not support managing snapshots");
    }

    @Override
    public Transaction newTransaction() {
      throw new UnsupportedOperationException("Cannot create a transaction within a transaction");
    }

    @Override
    public FileIO io() {
      return transactionOps.io();
    }

    @Override
    public EncryptionManager encryption() {
      return transactionOps.encryption();
    }

View on GitHub (pinned to 86d9c8fc54)