{"record":{"id":"7065f67f0a8821d7","repo":"apache/iceberg","slug":"operation-refresh-is-not-supported-after-the-table","errorCode":null,"errorMessage":"Operation refresh is not supported after the table is serialized","messagePattern":"Operation refresh is not supported after the table is serialized","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/SerializableTable.java","lineNumber":307,"sourceCode":"\n  @Override\n  public List<PartitionStatisticsFile> partitionStatisticsFiles() {\n    return lazyTable().partitionStatisticsFiles();\n  }\n\n  @Override\n  public Map<String, SnapshotRef> refs() {\n    return refs;\n  }\n\n  @Override\n  public UUID uuid() {\n    return uuid;\n  }\n\n  @Override\n  public void refresh() {\n    throw new UnsupportedOperationException(errorMsg(\"refresh\"));\n  }\n\n  @Override\n  public TableScan newScan() {\n    return lazyTable().newScan();\n  }\n\n  @Override\n  public IncrementalAppendScan newIncrementalAppendScan() {\n    return lazyTable().newIncrementalAppendScan();\n  }\n\n  @Override\n  public IncrementalChangelogScan newIncrementalChangelogScan() {\n    return lazyTable().newIncrementalChangelogScan();\n  }\n\n  @Override","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/SerializableTable.java#L289-L325","documentation":"SerializableTable is an immutable, serialized snapshot of a table. refresh() would reload metadata from the catalog, which is impossible after serialization, so it unconditionally throws UnsupportedOperationException with message 'Operation refresh is not supported after the table is serialized'.","triggerScenarios":"Calling table.refresh() on any SerializableTable instance, typically in task code that received the table via serialization and expects live-catalog semantics.","commonSituations":"Long-running Spark/Flink jobs re-reading a table expecting fresh metadata; code paths that call refresh() defensively before scanning.","solutions":["Re-load the table from the Catalog on the driver and re-serialize/distribute the fresh instance","Remove refresh() calls when working with the SerializableTable wrapper","Use the catalog handle (not the serialized table) when refresh semantics are needed"],"exampleFix":"// before\nserializableTable.refresh();\n// after\ntable = catalog.loadTable(identifier); // fresh, live table","handlingStrategy":"try-catch","validationCode":"if (table instanceof SerializableTable) { /* refresh unsupported; reload from catalog */ }","typeGuard":"boolean supportsRefresh = !(table instanceof SerializableTable);","tryCatchPattern":"try { table.refresh(); } catch (UnsupportedOperationException e) { table = catalog.loadTable(identifier); }","preventionTips":["Treat SerializableTable as immutable; reload from Catalog for fresh metadata","Keep the Catalog handle available wherever refresh is needed","Avoid defensive refresh() calls in executor code"],"tags":["iceberg","serialization","immutable"],"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-14T16:17:12.679Z"}