apache/iceberg · warning · java.lang.UnsupportedOperationException

Cannot copy

Error message

Cannot copy

What it means

ManifestFileBean is a lightweight serializable carrier for manifest metadata used during snapshot comparisons. Its copy() method is intentionally unsupported because the bean never needs deep copying in its internal usage; calling copy() throws UnsupportedOperationException with this message.

Solutions

  1. Do not call copy() on ManifestFileBean; use the bean directly
  2. Wrap the underlying real ManifestFile if an immutable copy is required
  3. Report upstream if framework code invokes copy() on this bean (it indicates misuse)
Defensive patterns

Strategy: type-guard

Type guard

boolean copyable(ManifestFile f) { return !(f instanceof ManifestFileBean); } // call copy() only on real ManifestFiles

Try / catch

try { file.copy(); } catch (UnsupportedOperationException e) { /* use the original instance; ManifestFileBean does not support copy */ }

Prevention

When it happens

Trigger: Calling copy() on a ManifestFileBean instance, e.g. when generic Iceberg code treats the bean as a full ManifestFile and requests an immutable deep copy.

Common situations: Custom actions or extensions reusing ManifestFileBean and passing it through APIs that call ManifestFile.copy(); internal misuse rather than user-facing API.

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/2ca4b6165b23c95b. Report an issue: GitHub.

Appendix: source

Thrown at spark/v4.2/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)