{"record":{"id":"a215b1f74e473998","repo":"apache/iceberg","slug":"cannot-create-transactions-for-a-s-table","errorCode":null,"errorMessage":"Cannot create transactions for a %s table","messagePattern":"Cannot create transactions for a (.+?) table","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/BaseReadOnlyTable.java","lineNumber":123,"sourceCode":"    throw new UnsupportedOperationException(\n        \"Cannot update partition statistics of a \" + descriptor + \" table\");\n  }\n\n  @Override\n  public ExpireSnapshots expireSnapshots() {\n    throw new UnsupportedOperationException(\n        \"Cannot expire snapshots from a \" + descriptor + \" table\");\n  }\n\n  @Override\n  public ManageSnapshots manageSnapshots() {\n    throw new UnsupportedOperationException(\n        \"Cannot manage snapshots in a \" + descriptor + \" table\");\n  }\n\n  @Override\n  public Transaction newTransaction() {\n    throw new UnsupportedOperationException(\n        \"Cannot create transactions for a \" + descriptor + \" table\");\n  }\n}\n","sourceCodeStart":105,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/BaseReadOnlyTable.java#L105-L127","documentation":"Read-only table guard in BaseReadOnlyTable: newTransaction() would open a multi-operation transaction against the table, which read-only table wrappers do not permit. It fires on the call itself; the 'descriptor' in the message identifies which kind of read-only view rejected it.","triggerScenarios":"Calling table.newTransaction() on any BaseReadOnlyTable-backed instance (snapshot wrapper, metadata table).","commonSituations":"Generic ETL code starting a transaction against whichever Table object it was handed, including snapshot handles used for time-travel reads.","solutions":["Obtain a writable table handle with catalog.loadTable(identifier) before newTransaction().","Restrict read-only handles to scan/plan code paths.","Add an instanceof/capability check in shared write utilities."],"exampleFix":"// before\nTransaction tx = readOnlyTable.newTransaction();\n// after\nTable table = catalog.loadTable(tableIdentifier);\nTransaction tx = table.newTransaction();","handlingStrategy":"validation","validationCode":"if (!(table instanceof BaseReadOnlyTable)) {\n  Transaction tx = table.newTransaction();\n}","typeGuard":"boolean supportsTransactions(Table t) { return !(t instanceof BaseReadOnlyTable); }","tryCatchPattern":"try { Transaction tx = table.newTransaction(); } catch (UnsupportedOperationException e) { table = catalog.loadTable(ident); }","preventionTips":["Start transactions only from catalog-loaded tables","Type-check handles in generic write utilities"],"tags":["unsupported-operation","read-only-table","transaction"],"backgroundTag":"unsupported-operation","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"}