{"record":{"id":"751c22cf9d6d57f8","repo":"apache/iceberg","slug":"transaction-tables-do-not-support-managing-snapsho","errorCode":null,"errorMessage":"Transaction tables do not support managing snapshots","messagePattern":"Transaction tables do not support managing snapshots","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/BaseTransaction.java","lineNumber":684,"sourceCode":"\n    @Override\n    public UpdateStatistics updateStatistics() {\n      return BaseTransaction.this.updateStatistics();\n    }\n\n    @Override\n    public UpdatePartitionStatistics updatePartitionStatistics() {\n      return BaseTransaction.this.updatePartitionStatistics();\n    }\n\n    @Override\n    public ExpireSnapshots expireSnapshots() {\n      return BaseTransaction.this.expireSnapshots();\n    }\n\n    @Override\n    public ManageSnapshots manageSnapshots() {\n      throw new UnsupportedOperationException(\n          \"Transaction tables do not support managing snapshots\");\n    }\n\n    @Override\n    public Transaction newTransaction() {\n      throw new UnsupportedOperationException(\"Cannot create a transaction within a transaction\");\n    }\n\n    @Override\n    public FileIO io() {\n      return transactionOps.io();\n    }\n\n    @Override\n    public EncryptionManager encryption() {\n      return transactionOps.encryption();\n    }\n","sourceCodeStart":666,"sourceCodeEnd":702,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/BaseTransaction.java#L666-L702","documentation":"The TransactionTable inside an open transaction does not support the ManageSnapshots API, because snapshot management (rollback, cherrypick, branch/tag creation) is itself implemented as a transaction-level operation and cannot nest inside an existing transaction. Calling manageSnapshots() throws UnsupportedOperationException immediately.","triggerScenarios":"Calling transaction.table().manageSnapshots() or any of its methods (rollbackTo, cherrypick, setCurrentSnapshot, createBranch) while inside table.newTransaction().","commonSituations":"Attempting rollback or branch creation as part of a larger write transaction; generic framework code that calls manageSnapshots() on any Table handle it receives.","solutions":["Perform snapshot management on the outer Table directly: table.manageSnapshots().rollbackTo(id).commit()","Sequence operations: commit the current transaction first, then manage snapshots","Refactor generic code to distinguish transaction tables from base tables"],"exampleFix":"// before\nTransaction tx = table.newTransaction();\ntx.table().manageSnapshots().rollbackTo(oldSnapshot).commit(); // throws\n// after\ntx.commitTransaction(); // finish current work first\ntable.manageSnapshots().rollbackTo(oldSnapshot).commit();","handlingStrategy":"validation","validationCode":"if (isTransactionTable(table)) { throw new IllegalStateException(\"manageSnapshots must be called on the base table\"); }","typeGuard":null,"tryCatchPattern":"catch (UnsupportedOperationException e) { outerTable.manageSnapshots()...commit(); }","preventionTips":["Treat snapshot management as a standalone operation, never nested in a transaction","Use table-level APIs, not Transaction.table(), for lifecycle operations","Remember transaction tables are write-only for data operations"],"tags":["unsupported-operation","transaction","snapshot-management"],"backgroundTag":"operation-not-supported","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"}