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"));
  }

  @Override

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Perform the rewrite on a catalog-connected Table: catalog.loadTable(identifier).newRewrite()...commit()
  2. Move RewriteFiles operations to the driver/master node where the table was originally loaded
  3. Use engine-native maintenance tools (e.g. Iceberg Spark procedures like rewrite_data_files) instead of manual rewrites in executors
  4. 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

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


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