{"record":{"id":"7ab60e51548018f1","repo":"apache/iceberg","slug":"cannot-call-commit-on-temporary-table-operations-7ab60e","errorCode":null,"errorMessage":"Cannot call commit on temporary table operations","messagePattern":"Cannot call commit on temporary table operations","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/hadoop/HadoopTableOperations.java","lineNumber":205,"sourceCode":"  }\n\n  @Override\n  public TableOperations temp(TableMetadata uncommittedMetadata) {\n    return new TableOperations() {\n      @Override\n      public TableMetadata current() {\n        return uncommittedMetadata;\n      }\n\n      @Override\n      public TableMetadata refresh() {\n        throw new UnsupportedOperationException(\n            \"Cannot call refresh on temporary table operations\");\n      }\n\n      @Override\n      public void commit(TableMetadata base, TableMetadata metadata) {\n        throw new UnsupportedOperationException(\"Cannot call commit on temporary table operations\");\n      }\n\n      @Override\n      public String metadataFileLocation(String fileName) {\n        return HadoopTableOperations.this.metadataFileLocation(fileName);\n      }\n\n      @Override\n      public LocationProvider locationProvider() {\n        return LocationProviders.locationsFor(\n            uncommittedMetadata.location(), uncommittedMetadata.properties());\n      }\n\n      @Override\n      public FileIO io() {\n        return HadoopTableOperations.this.io();\n      }\n","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/hadoop/HadoopTableOperations.java#L187-L223","documentation":"The temporary TableOperations created during commit cannot commit itself; its commit() unconditionally throws UnsupportedOperationException. Commits must be issued on the outer HadoopTableOperations instance. This prevents recursive/invalid commit state transitions.","triggerScenarios":"Calling commit() on the temporary operations instance yielded during a commit transaction; nested commit attempts inside commit hooks or listeners.","commonSituations":"Framework code that wraps any TableOperations and calls commit on it during another commit; accidental variable shadowing where tempOps is used instead of the real ops reference.","solutions":["Call commit() only on the outer HadoopTableOperations, never on the temporary instance","Move any additional writes after the outer commit completes","Refactor commit hooks to only read state (current()) rather than mutate"],"exampleFix":"// before\ntempOps.commit(base, metadata); // inside commit flow\n// after\nhadoopOps.commit(base, metadata); // commit on the real operations","handlingStrategy":"type-guard","validationCode":"if (isTemporaryOps(ops)) { /* do not commit */ }","typeGuard":"boolean isCommittable(TableOperations ops) { return ops instanceof HadoopTableOperations; }","tryCatchPattern":null,"preventionTips":["Issue commits only on the primary HadoopTableOperations instance","Avoid nested commits inside commit callbacks","Name temporary operations variables clearly (e.g., tempOps) to avoid misuse"],"tags":["unsupported-operation","commit","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-14T16:17:12.679Z"}