apache/iceberg · error · UnsupportedOperationException

Transaction tables do not support scans

Error message

Transaction tables do not support scans

What it means

The TransactionTable view exposed inside an open transaction deliberately does not support scans. newScan() throws UnsupportedOperationException because reads must be performed against the committed table, not against in-transaction (uncommitted) metadata. The transaction table implementation is write-only within the transaction scope.

Solutions

  1. Perform reads against the outer Table object (before the transaction or after commit)
  2. Split the workflow: scan the committed table, then open a transaction for writes
  3. Restructure code so read paths receive the base Table, not Transaction.table()

Example fix

// before
Transaction tx = table.newTransaction();
TableScan scan = tx.table().newScan(); // throws
// after
TableScan scan = table.newScan(); // read from committed table
Transaction tx = table.newTransaction();
// ... write via tx ...
tx.commitTransaction();
Defensive patterns

Strategy: validation

Validate before calling

if (isTransactionTable(table)) { throw new IllegalStateException("Use the outer table for scans"); }

Try / catch

catch (UnsupportedOperationException e) { scanOuterTable(); }

Prevention

When it happens

Trigger: Calling newScan() on the Table returned by Transaction.table(), or any API that internally scans, while inside table.newTransaction().

Common situations: Developers trying to read data written earlier in the same transaction to verify it; copy-on-write merge logic attempting a scan inside a transaction; generic code paths that assume every Table supports scans.

Related errors


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

Appendix: source

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

  public class TransactionTable implements Table, HasTableOperations, Serializable {

    @Override
    public TableOperations operations() {
      return transactionOps;
    }

    @Override
    public String name() {
      return tableName;
    }

    @Override
    public void refresh() {}

    @Override
    public TableScan newScan() {
      throw new UnsupportedOperationException("Transaction tables do not support scans");
    }

    @Override
    public Schema schema() {
      return current.schema();
    }

    @Override
    public Map<Integer, Schema> schemas() {
      return current.schemasById();
    }

    @Override
    public PartitionSpec spec() {
      return current.spec();
    }

    @Override

View on GitHub (pinned to 86d9c8fc54)