apache/iceberg · error · UnsupportedOperationException
Cannot call commit on temporary table operations
Error message
Cannot call commit on temporary table operations
What it means
The temporary TableOperations created during commit cannot commit itself; its commit() unconditionally throws UnsupportedOperationException. Commits must be issued on the outer HadoopTableOperations instance. This prevents recursive/invalid commit state transitions.
Source
Thrown at core/src/main/java/org/apache/iceberg/hadoop/HadoopTableOperations.java:205
}
@Override
public TableOperations temp(TableMetadata uncommittedMetadata) {
return new TableOperations() {
@Override
public TableMetadata current() {
return uncommittedMetadata;
}
@Override
public TableMetadata refresh() {
throw new UnsupportedOperationException(
"Cannot call refresh on temporary table operations");
}
@Override
public void commit(TableMetadata base, TableMetadata metadata) {
throw new UnsupportedOperationException("Cannot call commit on temporary table operations");
}
@Override
public String metadataFileLocation(String fileName) {
return HadoopTableOperations.this.metadataFileLocation(fileName);
}
@Override
public LocationProvider locationProvider() {
return LocationProviders.locationsFor(
uncommittedMetadata.location(), uncommittedMetadata.properties());
}
@Override
public FileIO io() {
return HadoopTableOperations.this.io();
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Call commit() only on the outer HadoopTableOperations, never on the temporary instance
- Move any additional writes after the outer commit completes
- Refactor commit hooks to only read state (current()) rather than mutate
Example fix
// before tempOps.commit(base, metadata); // inside commit flow // after hadoopOps.commit(base, metadata); // commit on the real operations
Defensive patterns
Strategy: type-guard
Validate before calling
if (isTemporaryOps(ops)) { /* do not commit */ } Type guard
boolean isCommittable(TableOperations ops) { return ops instanceof HadoopTableOperations; } Prevention
- Issue commits only on the primary HadoopTableOperations instance
- Avoid nested commits inside commit callbacks
- Name temporary operations variables clearly (e.g., tempOps) to avoid misuse
When it happens
Trigger: Calling commit() on the temporary operations instance yielded during a commit transaction; nested commit attempts inside commit hooks or listeners.
Common situations: Framework code that wraps any TableOperations and calls commit on it during another commit; accidental variable shadowing where tempOps is used instead of the real ops reference.
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
- Cannot call refresh on temporary table operations
- Cannot call commit on temporary table operations
- Update type %s is not supported
- Cannot call commit on temporary table operations
- Cannot call commit on temporary table operations
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/7ab60e51548018f1.
Report an issue: GitHub.