apache/iceberg · error · UnsupportedOperationException

Managing snapshots is not supported by + getClass().getName(

Error message

Managing snapshots is not supported by + getClass().getName()

What it means

Transaction.manageSnapshots() is a default API method that throws UnsupportedOperationException because the concrete Transaction implementation does not support snapshot management operations. Iceberg uses this pattern for optional API surface: only implementations that can manage snapshots (e.g. a full table-backed transaction) override it. The message includes the class name so you can see which implementation lacks support.

Source

Thrown at api/src/main/java/org/apache/iceberg/Transaction.java:175

  default UpdatePartitionStatistics updatePartitionStatistics() {
    throw new UnsupportedOperationException(
        "Updating partition statistics is not supported by " + getClass().getName());
  }

  /**
   * Create a new {@link ExpireSnapshots expire API} to expire snapshots in this table.
   *
   * @return a new {@link ExpireSnapshots}
   */
  ExpireSnapshots expireSnapshots();

  /**
   * Create a new {@link ManageSnapshots manage snapshot API} to manage snapshots in this table.
   *
   * @return a new {@link ManageSnapshots}
   */
  default ManageSnapshots manageSnapshots() {
    throw new UnsupportedOperationException(
        "Managing snapshots is not supported by " + getClass().getName());
  }

  /**
   * Apply the pending changes from all actions and commit.
   *
   * @throws ValidationException If any update cannot be applied to the current table metadata.
   * @throws CommitFailedException If the updates cannot be committed due to conflicts.
   */
  void commitTransaction();
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Manage snapshots directly on the Table (table.manageSnapshots()) instead of through the Transaction.
  2. Use separate transactions: commit data/schema changes first, then manage snapshots on the committed table.
  3. Check the concrete Transaction implementation to confirm which operations it supports before using optional APIs.
  4. Upgrade Iceberg if a newer version added snapshot-management support to your implementation.

Example fix

// before
Transaction tx = table.newTransaction();
tx.manageSnapshots().cherrypick();

// after
Transaction tx = table.newTransaction();
tx.newAppend().appendFile(file).commit();
tx.commitTransaction();
table.manageSnapshots().cherrypick(snapshotId).commit();
Defensive patterns

Strategy: try-catch

Validate before calling

if (tx.getClass().getSimpleName().toLowerCase().contains("transaction") && tx instanceof Transaction) {
  // only call manageSnapshots() on implementations known to support it
}

Type guard

boolean supportsSnapshotMgmt = !tx.getClass().getName().contains("BaseTransaction") && tx.manageSnapshotsIfSupported(); // feature-check via implementation docs

Try / catch

try {
  tx.manageSnapshots().cherrypick(id).commit();
} catch (UnsupportedOperationException e) {
  // fall back to table.manageSnapshots()
  table.manageSnapshots().cherrypick(id).commit();
}

Prevention

When it happens

Trigger: Calling transaction.manageSnapshots() (or table.transaction().manageSnapshots()) on a Transaction implementation that does not override the default method, e.g. transactions obtained from contexts that only support schema/partition updates.

Common situations: Wrapping table changes in a transaction and then attempting to cherry-pick, rollback, or set current snapshot through the same transaction; using a custom or catalog-provided Transaction class that implements only a subset of operations.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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