apache/iceberg · error · UnsupportedOperationException
Cannot copy
Error message
Cannot copy
What it means
ManifestFileBean.copy() is intentionally unimplemented: these beans are deserialized carriers of manifest file info and are never supposed to be copied; calling copy() always throws UnsupportedOperationException("Cannot copy").
Source
Thrown at spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/actions/ManifestFileBean.java:199
@Override
public List<PartitionFieldSummary> partitions() {
return null;
}
@Override
public ByteBuffer keyMetadata() {
return keyMetadata == null ? null : ByteBuffer.wrap(keyMetadata);
}
@Override
public Long firstRowId() {
return firstRowId;
}
@Override
public ManifestFile copy() {
throw new UnsupportedOperationException("Cannot copy");
}
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Do not call copy() on ManifestFileBean; construct a new ManifestFileBean or keep the reference as-is
- If a real ManifestFile is needed, build one from the bean's fields (path, partition spec id, etc.) or use the original ManifestFile from the snapshot
- Wrap in an adapter implementing copy() by constructing a fresh ImmutableGenericManifestFile if your code requires the ManifestFile interface
Example fix
// before ManifestFile copy = manifestBean.copy(); // throws // after ManifestFile copy = new ManifestFileBean(...fields copied from manifestBean...); // or keep the bean
Defensive patterns
Strategy: type-guard
Validate before calling
if (file instanceof ManifestFileBean) { /* do not call copy() */ } Type guard
boolean copyable = !(f instanceof ManifestFileBean);
Prevention
- Treat ManifestFileBean as read-only carrier
- Never call ManifestFile.copy() on beans
- Build a fresh bean/ImmutableGenericManifestFile if a detached copy is needed
When it happens
Trigger: Calling copy() on a ManifestFileBean obtained from a rewrite/partial-progress path (e.g. iterating RewriteFileGroup manifests and treating them as regular ManifestFiles that support copy).
Common situations: Custom code that collects ManifestFile instances from a datastream of ManifestFileBeans and calls copy() (e.g. to detach from a reusable container), or new Iceberg code paths added on top of these beans.
Related errors
- Unknown field ordinal:
- Cannot apply unknown table change: ${change}
- SparkCachedTableCatalog does not support altering tables
- SparkCachedTableCatalog does not support dropping tables
- SparkCachedTableCatalog does not support purging tables
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/a446e8af74935a96.
Report an issue: GitHub.