{"record":{"id":"c978f354e64d5a62","repo":"apache/iceberg","slug":"cannot-rewrite-manifests-in-a-s-table","errorCode":null,"errorMessage":"Cannot rewrite manifests in a %s table","messagePattern":"Cannot rewrite manifests in a (.+?) table","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/BaseReadOnlyTable.java","lineNumber":71,"sourceCode":"  @Override\n  public UpdateLocation updateLocation() {\n    throw new UnsupportedOperationException(\n        \"Cannot update the location of a \" + descriptor + \" table\");\n  }\n\n  @Override\n  public AppendFiles newAppend() {\n    throw new UnsupportedOperationException(\"Cannot append to a \" + descriptor + \" table\");\n  }\n\n  @Override\n  public RewriteFiles newRewrite() {\n    throw new UnsupportedOperationException(\"Cannot rewrite in a \" + descriptor + \" table\");\n  }\n\n  @Override\n  public RewriteManifests rewriteManifests() {\n    throw new UnsupportedOperationException(\n        \"Cannot rewrite manifests in a \" + descriptor + \" table\");\n  }\n\n  @Override\n  public OverwriteFiles newOverwrite() {\n    throw new UnsupportedOperationException(\"Cannot overwrite in a \" + descriptor + \" table\");\n  }\n\n  @Override\n  public RowDelta newRowDelta() {\n    throw new UnsupportedOperationException(\n        \"Cannot remove or replace rows in a \" + descriptor + \" table\");\n  }\n\n  @Override\n  public ReplacePartitions newReplacePartitions() {\n    throw new UnsupportedOperationException(\n        \"Cannot replace partitions in a \" + descriptor + \" table\");","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/BaseReadOnlyTable.java#L53-L89","documentation":"Iceberg throws this UnsupportedOperationException when rewriteManifests() is called on a read-only table. Rewriting manifests commits new metadata, which BaseReadOnlyTable subclasses never permit. The descriptor names the read-only table kind.","triggerScenarios":"Calling table.rewriteManifests().execute() on a metadata table or any BaseReadOnlyTable subclass instance.","commonSituations":"Metadata compaction jobs applied across all Table handles including metadata tables obtained from table.metadataTableReferences().","solutions":["Execute manifest rewriting on the writable data table loaded via catalog.loadTable(identifier).","Filter metadata tables out of maintenance job table lists.","If manifests only need inspection, use table.scan manifests/metadata APIs instead."],"exampleFix":"// before\ntable.snapshots().rewriteManifests().execute();\n\n// after\nTable dataTable = catalog.loadTable(TableIdentifier.of(\"db\", \"tbl\"));\ndataTable.rewriteManifests().execute();","handlingStrategy":"try-catch","validationCode":"if (isMetadataTableName(table.name())) { throw new IllegalArgumentException(\"Cannot rewrite manifests of metadata table \" + table.name()); }","typeGuard":"boolean canRewriteManifests = !(table instanceof BaseReadOnlyTable); // ensure handle came from Catalog.loadTable","tryCatchPattern":"try {\n  table.rewriteManifests().execute();\n} catch (UnsupportedOperationException e) {\n  log.error(\"Manifest rewriting is not supported on read-only table {}\", table.name(), e);\n}","preventionTips":["Run manifest compaction only on catalog-loaded data tables.","Exclude table.metadataTableReferences() results from maintenance lists.","Use scan/manifest APIs for inspection instead of the rewrite action."],"tags":["unsupported-operation","manifests","read-only-table"],"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"}