apache/iceberg · error · UnsupportedOperationException
Cannot rewrite manifests in a
Error message
Cannot rewrite manifests in a %s table
What it means
Iceberg throws this UnsupportedOperationException when rewriteManifests() is called on a read-only table. Rewriting manifests commits new metadata, which BaseReadOnlyTable subclasses never permit. The descriptor names the read-only table kind.
Solutions
- Execute manifest rewriting on the writable data table loaded via catalog.loadTable(identifier).
- Filter metadata tables out of maintenance job table lists.
- If manifests only need inspection, use table.scan manifests/metadata APIs instead.
Example fix
// before
table.snapshots().rewriteManifests().execute();
// after
Table dataTable = catalog.loadTable(TableIdentifier.of("db", "tbl"));
dataTable.rewriteManifests().execute(); Defensive patterns
Strategy: try-catch
Validate before calling
if (isMetadataTableName(table.name())) { throw new IllegalArgumentException("Cannot rewrite manifests of metadata table " + table.name()); } Type guard
boolean canRewriteManifests = !(table instanceof BaseReadOnlyTable); // ensure handle came from Catalog.loadTable
Try / catch
try {
table.rewriteManifests().execute();
} catch (UnsupportedOperationException e) {
log.error("Manifest rewriting is not supported on read-only table {}", table.name(), e);
} Prevention
- Run manifest compaction only on catalog-loaded data tables.
- Exclude table.metadataTableReferences() results from maintenance lists.
- Use scan/manifest APIs for inspection instead of the rewrite action.
When it happens
Trigger: Calling table.rewriteManifests().execute() on a metadata table or any BaseReadOnlyTable subclass instance.
Common situations: Metadata compaction jobs applied across all Table handles including metadata tables obtained from table.metadataTableReferences().
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 append to a table
- Cannot create transactions for a
- Cannot delete from a
- Cannot expire snapshots from a
- Cannot manage snapshots in a
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/c978f354e64d5a62.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/apache/iceberg/BaseReadOnlyTable.java:71
@Override
public UpdateLocation updateLocation() {
throw new UnsupportedOperationException(
"Cannot update the location of a " + descriptor + " table");
}
@Override
public AppendFiles newAppend() {
throw new UnsupportedOperationException("Cannot append to a " + descriptor + " table");
}
@Override
public RewriteFiles newRewrite() {
throw new UnsupportedOperationException("Cannot rewrite in a " + descriptor + " table");
}
@Override
public RewriteManifests rewriteManifests() {
throw new UnsupportedOperationException(
"Cannot rewrite manifests in a " + descriptor + " table");
}
@Override
public OverwriteFiles newOverwrite() {
throw new UnsupportedOperationException("Cannot overwrite in a " + descriptor + " table");
}
@Override
public RowDelta newRowDelta() {
throw new UnsupportedOperationException(
"Cannot remove or replace rows in a " + descriptor + " table");
}
@Override
public ReplacePartitions newReplacePartitions() {
throw new UnsupportedOperationException(
"Cannot replace partitions in a " + descriptor + " table");View on GitHub (pinned to 86d9c8fc54)