{"record":{"id":"81cd55001b0500d4","repo":"apache/iceberg","slug":"operation-updatelocation-is-not-supported-after-th","errorCode":null,"errorMessage":"Operation updateLocation is not supported after the table is serialized","messagePattern":"Operation updateLocation 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":372,"sourceCode":"\n  @Override\n  public UpdatePartitionSpec updateSpec() {\n    throw new UnsupportedOperationException(errorMsg(\"updateSpec\"));\n  }\n\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","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/SerializableTable.java#L354-L390","documentation":"SerializableTable is a read-only snapshot of a Table used for distributed execution (it serializes the table metadata and FileIO, but cannot commit changes back to a catalog). All mutation-producing methods like updateLocation() are overridden to throw UnsupportedOperationException with this message, because a serialized table has no live catalog connection to commit metadata updates through. If you need to mutate the table, use the original Table reference obtained from a catalog.","triggerScenarios":"Calling table.updateLocation() on a table instance that was wrapped by SerializableTable and deserialized after shipping across a task boundary (e.g. inside a Spark/Flink executor task).","commonSituations":"Framework-internal misuse where a serialized table is accidentally used as if it were the driver-side table; custom sink/committer code storing a SerializableTable and later attempting to set the table location; accidentally serializing a Table with SerializableTable.wrap(table) then reusing the wrapped copy for writes.","solutions":["Use the original Table reference from the catalog (Catalog.loadTable) instead of the SerializableTable copy when calling updateLocation()","Check whether the code path is running on a driver/catalog-connected node rather than on a distributed worker holding a serialized table","Restructure so mutation operations run outside the serialized-table scope: collect results on workers, then apply updates via the catalog-backed Table on the driver","If the framework hands you a Table, verify it is not a SerializableTable (instanceof SerializableTable) before attempting writes"],"exampleFix":"// before\nTable table = SerializableTable.wrap(driverTable);\ntable.updateLocation().setLocation(newLoc).commit();\n// after\nTable table = catalog.loadTable(identifier); // live, catalog-backed table\ntable.updateLocation().setLocation(newLoc).commit();","handlingStrategy":"try-catch","validationCode":"if (table instanceof org.apache.iceberg.SerializableTable) {\n  throw new IllegalStateException(\"Use a catalog-backed Table, not a SerializableTable, for commits\");\n}","typeGuard":"function isSerializableTable(t) { return t instanceof org.apache.iceberg.SerializableTable; } // guard in Java: boolean ok = !(table instanceof SerializableTable);","tryCatchPattern":"try {\n  table.updateLocation().setLocation(loc).commit();\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"not supported after the table is serialized\")) {\n    table = catalog.loadTable(identifier); // re-load live table and retry\n    table.updateLocation().setLocation(loc).commit();\n  } else { throw e; }\n}","preventionTips":["Keep SerializableTable instances strictly for read/scan work on workers","Always reload the table from the Catalog before any commit-producing operation","In shared helper APIs, document/require a catalog-backed Table and fail fast on SerializableTable","Remember serialization severs the catalog connection: only reads survive"],"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-14T11:17:12.474Z"}