{"record":{"id":"a446e8af74935a96","repo":"apache/iceberg","slug":"cannot-copy","errorCode":null,"errorMessage":"Cannot copy","messagePattern":"Cannot copy","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/actions/ManifestFileBean.java","lineNumber":199,"sourceCode":"\n  @Override\n  public List<PartitionFieldSummary> partitions() {\n    return null;\n  }\n\n  @Override\n  public ByteBuffer keyMetadata() {\n    return keyMetadata == null ? null : ByteBuffer.wrap(keyMetadata);\n  }\n\n  @Override\n  public Long firstRowId() {\n    return firstRowId;\n  }\n\n  @Override\n  public ManifestFile copy() {\n    throw new UnsupportedOperationException(\"Cannot copy\");\n  }\n}\n","sourceCodeStart":181,"sourceCodeEnd":202,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/actions/ManifestFileBean.java#L181-L202","documentation":"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\").","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nManifestFile copy = manifestBean.copy(); // throws\n// after\nManifestFile copy = new ManifestFileBean(...fields copied from manifestBean...); // or keep the bean","handlingStrategy":"type-guard","validationCode":"if (file instanceof ManifestFileBean) { /* do not call copy() */ }","typeGuard":"boolean copyable = !(f instanceof ManifestFileBean);","tryCatchPattern":null,"preventionTips":["Treat ManifestFileBean as read-only carrier","Never call ManifestFile.copy() on beans","Build a fresh bean/ImmutableGenericManifestFile if a detached copy is needed"],"tags":["spark","unsupported-operation","manifest-file"],"backgroundTag":"method-not-implemented","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}