{"record":{"id":"2ca4b6165b23c95b","repo":"apache/iceberg","slug":"cannot-copy-2ca4b6","errorCode":null,"errorMessage":"Cannot copy","messagePattern":"Cannot copy","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"spark/v4.2/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.2/spark/src/main/java/org/apache/iceberg/spark/actions/ManifestFileBean.java#L181-L202","documentation":"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.","triggerScenarios":"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.","commonSituations":"Custom actions or extensions reusing ManifestFileBean and passing it through APIs that call ManifestFile.copy(); internal misuse rather than user-facing API.","solutions":["Do not call copy() on ManifestFileBean; use the bean directly","Wrap the underlying real ManifestFile if an immutable copy is required","Report upstream if framework code invokes copy() on this bean (it indicates misuse)"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"boolean copyable(ManifestFile f) { return !(f instanceof ManifestFileBean); } // call copy() only on real ManifestFiles","tryCatchPattern":"try { file.copy(); } catch (UnsupportedOperationException e) { /* use the original instance; ManifestFileBean does not support copy */ }","preventionTips":["Treat ManifestFileBean as a plain serializable carrier, never as a full ManifestFile","Keep copies of the original ManifestFile, not its bean representation","Do not route beans through APIs that call ManifestFile.copy()"],"tags":["unsupported-operation","manifest","internal"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}