apache/iceberg · error · UnsupportedOperationException

Cannot copy IndexedDataFile wrapper

Error message

Cannot copy IndexedDataFile wrapper

What it means

Guard on V2Metadata.IndexedDataFile.copy: this wrapper lazily derives sequence-number columns when reading v1 manifests as v2, so it has no standalone copy semantics. Both copy() and copyWithStats() refuse; the wrapped ContentFile must be used to obtain copies with truncated or full stats.

Solutions

  1. Call copy()/copyWithStats() on the wrapped ContentFile instead of the wrapper
  2. Avoid holding wrappers beyond the read loop; materialize needed data before discarding
  3. Refactor the caller to operate on the underlying file object
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at core/src/main/java/org/apache/iceberg/V2Metadata.java:581 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at core/src/main/java/org/apache/iceberg/V2Metadata.java:581

    @Override
    public Integer sortOrderId() {
      return wrapped.sortOrderId();
    }

    @Override
    public Long dataSequenceNumber() {
      return wrapped.dataSequenceNumber();
    }

    @Override
    public Long fileSequenceNumber() {
      return wrapped.fileSequenceNumber();
    }

    @Override
    public F copy() {
      throw new UnsupportedOperationException("Cannot copy IndexedDataFile wrapper");
    }

    @Override
    public F copyWithStats(Set<Integer> requestedColumnIds) {
      throw new UnsupportedOperationException("Cannot copy IndexedDataFile wrapper");
    }

    @Override
    public F copyWithoutStats() {
      throw new UnsupportedOperationException("Cannot copy IndexedDataFile wrapper");
    }
  }

  private static void checkContentType(ManifestContent content) {
    Preconditions.checkArgument(
        content == ManifestContent.DATA || content == ManifestContent.DELETES,
        "Unsupported manifest content type for v2: %s",
        content);

View on GitHub (pinned to 86d9c8fc54)