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
- Perform reads against the outer Table object (before the transaction or after commit)
- Split the workflow: scan the committed table, then open a transaction for writes
- 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
- Never call read/scan APIs on Transaction.table(); only use it for writes
- Keep read and write phases of a workflow clearly separated
- Wrap Transaction.table() in a write-only facade to prevent accidental scans
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
- Cannot call refresh on temporary table operations
- Cannot call refresh on temporary table operations
- Cannot create a transaction within a transaction
- Cannot create transactions for a
- Managing snapshots is not supported by +…
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();
}
@OverrideView on GitHub (pinned to 86d9c8fc54)