apache/iceberg · error · UnsupportedOperationException
Operation newRewrite is not supported after the table is ser
Error message
Operation newRewrite is not supported after the table is serialized
What it means
A SerializableTable is a serialized, read-only view of an Iceberg table used on distributed workers. Since rewriting files changes table metadata and requires committing through a catalog, newRewrite() throws UnsupportedOperationException with this message. Use a catalog-backed Table instance for compaction/rewrite operations.
Source
Thrown at core/src/main/java/org/apache/iceberg/SerializableTable.java:382
@Override
public ReplaceSortOrder replaceSortOrder() {
throw new UnsupportedOperationException(errorMsg("replaceSortOrder"));
}
@Override
public UpdateLocation updateLocation() {
throw new UnsupportedOperationException(errorMsg("updateLocation"));
}
@Override
public AppendFiles newAppend() {
throw new UnsupportedOperationException(errorMsg("newAppend"));
}
@Override
public RewriteFiles newRewrite() {
throw new UnsupportedOperationException(errorMsg("newRewrite"));
}
@Override
public RewriteManifests rewriteManifests() {
throw new UnsupportedOperationException(errorMsg("rewriteManifests"));
}
@Override
public OverwriteFiles newOverwrite() {
throw new UnsupportedOperationException(errorMsg("newOverwrite"));
}
@Override
public RowDelta newRowDelta() {
throw new UnsupportedOperationException(errorMsg("newRowDelta"));
}
@OverrideView on GitHub (pinned to 86d9c8fc54)
Solutions
- Perform the rewrite on a catalog-connected Table: catalog.loadTable(identifier).newRewrite()...commit()
- Move RewriteFiles operations to the driver/master node where the table was originally loaded
- Use engine-native maintenance tools (e.g. Iceberg Spark procedures like rewrite_data_files) instead of manual rewrites in executors
- Reject SerializableTable instances early with an instanceof check before starting rewrite logic
Example fix
// before Table table = serializedCopy; table.newRewrite().rewriteFiles(added, deleted).commit(); // after Table table = catalog.loadTable(identifier); // driver-side, catalog-backed table.newRewrite().rewriteFiles(added, deleted).commit();
Defensive patterns
Strategy: try-catch
Validate before calling
if (table instanceof org.apache.iceberg.SerializableTable) {
throw new IllegalStateException("newRewrite() requires a catalog-backed Table");
} Type guard
boolean rewritable = !(table instanceof org.apache.iceberg.SerializableTable);
Try / catch
try {
table.newRewrite().rewriteFiles(added, deleted).commit();
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("not supported after the table is serialized")) {
catalog.loadTable(identifier).newRewrite().rewriteFiles(added, deleted).commit();
} else { throw e; }
} Prevention
- Run rewrites/compaction where the table was loaded from the catalog
- Do not serialize Table objects for write jobs; pass identifiers instead
- Use maintenance procedures (rewrite_data_files) rather than custom executor rewrites
- Fail fast on SerializableTable instances before beginning rewrite plans
When it happens
Trigger: Calling table.newRewrite() on a table obtained by serializing with SerializableTable.wrap(...) and deserializing on a worker node, e.g. inside a distributed maintenance job.
Common situations: Custom compaction/rewrite jobs that serialize the Table object and try to perform RewriteFiles inside executors; copying driver code into worker code without realizing the table type changed.
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
- Operation updateLocation is not supported after the table is
- Operation newAppend is not supported after the table is seri
- Operation rewriteManifests is not supported after the table
- Operation newOverwrite is not supported after the table is s
- Operation newRowDelta is not supported after the table is se
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/9e83062e274ff975.
Report an issue: GitHub.