{"record":{"id":"be64bcdc705a3ba8","repo":"apache/iceberg","slug":"cleanexpiredmetadata-is-not-supported","errorCode":null,"errorMessage":"cleanExpiredMetadata is not supported","messagePattern":"cleanExpiredMetadata is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/actions/ExpireSnapshots.java","lineNumber":112,"sourceCode":"   *\n   * @param executorService the service to use\n   * @return this for method chaining\n   */\n  ExpireSnapshots executeDeleteWith(ExecutorService executorService);\n\n  /**\n   * Expires unused table metadata such as partition specs and schemas.\n   *\n   * <p>Metadata such as partition specs or schemas that are no longer referenced by snapshots will\n   * be removed.\n   *\n   * <p>Identical to {@link org.apache.iceberg.ExpireSnapshots#cleanExpiredMetadata(boolean)}\n   *\n   * @param clean remove unused partition specs, schemas, or other metadata when true\n   * @return this for method chaining\n   */\n  default ExpireSnapshots cleanExpiredMetadata(boolean clean) {\n    throw new UnsupportedOperationException(\"cleanExpiredMetadata is not supported\");\n  }\n\n  /** The action result that contains a summary of the execution. */\n  interface Result {\n    /** Returns the number of deleted data files. */\n    long deletedDataFilesCount();\n\n    /** Returns the number of deleted equality delete files. */\n    long deletedEqualityDeleteFilesCount();\n\n    /** Returns the number of deleted position delete files. */\n    long deletedPositionDeleteFilesCount();\n\n    /** Returns the number of deleted manifests. */\n    long deletedManifestsCount();\n\n    /** Returns the number of deleted manifest lists. */\n    long deletedManifestListsCount();","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/actions/ExpireSnapshots.java#L94-L130","documentation":"ExpireSnapshots is an action interface whose fluent option cleanExpiredMetadata(boolean) — controlling removal of unused partition specs, schemas, and other metadata during expiration — is a default that throws UnsupportedOperationException. It indicates the action implementation does not support metadata cleanup during snapshot expiration.","triggerScenarios":"Calling expireSnapshots(...).cleanExpiredMetadata(true) on an action implementation that has not overridden the method, e.g., an older engine runtime or custom action.","commonSituations":"Attempting full metadata GC (specs/schemas cleanup) with an engine integration that predates the option; following current examples against an older Iceberg dependency.","solutions":["Upgrade the engine integration module to a version whose ExpireSnapshots implementation supports cleanExpiredMetadata.","Remove the cleanExpiredMetadata call if metadata cleanup is not required (snapshots-only expiration still works).","Override cleanExpiredMetadata in a custom ExpireSnapshots implementation."],"exampleFix":"// before\nExpireSnapshots a = SparkActions.get().expireSnapshots(table).cleanExpiredMetadata(true); // throws on old impl\n// after (upgrade iceberg-spark, or drop the call)\nExpireSnapshots a = SparkActions.get().expireSnapshots(table);","handlingStrategy":"try-catch","validationCode":"boolean ok = Arrays.stream(expire.getClass().getMethods()).anyMatch(m -> \"cleanExpiredMetadata\".equals(m.getName()) && m.getDeclaringClass() != ExpireSnapshots.class);","typeGuard":"boolean implemented = expire.getClass() != ExpireSnapshots.class;","tryCatchPattern":"try { expire = expire.cleanExpiredMetadata(true); } catch (UnsupportedOperationException e) { LOG.warn(\"Metadata cleanup unsupported; expiring snapshots only\"); }","preventionTips":["Check Iceberg engine-integration version support before enabling metadata GC","Treat metadata cleanup as opt-in and degrade gracefully when unsupported"],"tags":["java","iceberg","unsupported-operation","snapshot-expiration"],"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"}