{"record":{"id":"174e331442a41221","repo":"apache/iceberg","slug":"operation-newappend-is-not-supported-after-the-tab","errorCode":null,"errorMessage":"Operation newAppend is not supported after the table is serialized","messagePattern":"Operation newAppend 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":377,"sourceCode":"\n  @Override\n  public UpdateProperties updateProperties() {\n    throw new UnsupportedOperationException(errorMsg(\"updateProperties\"));\n  }\n\n  @Override\n  public ReplaceSortOrder replaceSortOrder() {\n    throw new UnsupportedOperationException(errorMsg(\"replaceSortOrder\"));\n  }\n\n  @Override\n  public UpdateLocation updateLocation() {\n    throw new UnsupportedOperationException(errorMsg(\"updateLocation\"));\n  }\n\n  @Override\n  public AppendFiles newAppend() {\n    throw new UnsupportedOperationException(errorMsg(\"newAppend\"));\n  }\n\n  @Override\n  public RewriteFiles newRewrite() {\n    throw new UnsupportedOperationException(errorMsg(\"newRewrite\"));\n  }\n\n  @Override\n  public RewriteManifests rewriteManifests() {\n    throw new UnsupportedOperationException(errorMsg(\"rewriteManifests\"));\n  }\n\n  @Override\n  public OverwriteFiles newOverwrite() {\n    throw new UnsupportedOperationException(errorMsg(\"newOverwrite\"));\n  }\n\n  @Override","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/SerializableTable.java#L359-L395","documentation":"SerializableTable represents a Table that has been serialized for use in a distributed task (Spark/Flink executors). It carries table metadata for reads and scans only; it has no catalog connection and cannot commit snapshots. newAppend() is therefore deliberately unsupported and throws UnsupportedOperationException to prevent silent, lost writes.","triggerScenarios":"Calling table.newAppend() on a deserialized SerializableTable inside a worker task (e.g. inside a mapPartitions/MapFunction that received a serialized table).","commonSituations":"Writing data in a Spark/Flink job by obtaining a Table from a serialized reference; custom writers created from SerializableTable instead of a catalog-loaded table; moving code from driver-side (where newAppend works) into executor code.","solutions":["Load the table fresh from the catalog where the append should commit: catalog.loadTable(identifier).newAppend()...commit()","Run the append on the driver/catalog-connected context, not inside the distributed task holding the serialized table","Use the framework's built-in writer (e.g. iceberg-spark's writes) instead of manually appending from executor code","Guard against misuse with an instanceof SerializableTable check before creating write operations"],"exampleFix":"// before\nTable table = serializedTable; // SerializableTable on executor\ntable.newAppend().appendFile(df).commit();\n// after\n// on the driver, with a catalog connection:\nTable table = catalog.loadTable(identifier);\ntable.newAppend().appendFile(df).commit();","handlingStrategy":"try-catch","validationCode":"if (table instanceof org.apache.iceberg.SerializableTable) {\n  throw new IllegalStateException(\"newAppend() requires a catalog-backed Table\");\n}","typeGuard":"boolean canCommit = !(table instanceof org.apache.iceberg.SerializableTable);","tryCatchPattern":"try {\n  table.newAppend().appendFile(f).commit();\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"not supported after the table is serialized\")) {\n    catalog.loadTable(identifier).newAppend().appendFile(f).commit();\n  } else { throw e; }\n}","preventionTips":["Perform appends on the driver or wherever a live Catalog/Table is available","Ship data files, not the Table object, across task boundaries","Prefer engine-native sinks (Spark/Flink writers) over manual appends in executors","Type-check tables with instanceof SerializableTable in generic utilities"],"tags":["java","iceberg","unsupported-operation","serialization"],"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"}