{"record":{"id":"e67402243ba73f92","repo":"apache/iceberg","slug":"does-not-have-a-metadata-file-location","errorCode":null,"errorMessage":" does not have a metadata file location","messagePattern":" does not have a metadata file location","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/SerializableTable.java","lineNumber":116,"sourceCode":"  }\n\n  /**\n   * Creates a read-only serializable table that can be sent to other nodes in a cluster.\n   *\n   * @param table the original table to copy the state from\n   * @return a read-only serializable table reflecting the current state of the original table\n   */\n  public static Table copyOf(Table table) {\n    if (table instanceof BaseMetadataTable) {\n      return new SerializableMetadataTable((BaseMetadataTable) table);\n    } else {\n      return new SerializableTable(table);\n    }\n  }\n\n  public String metadataFileLocation() {\n    if (metadataFileLocation == null) {\n      throw new UnsupportedOperationException(\n          this.getClass().getName() + \" does not have a metadata file location\");\n    }\n    return metadataFileLocation;\n  }\n\n  private String metadataFileLocation(Table table) {\n    if (table instanceof HasTableOperations) {\n      TableOperations ops = ((HasTableOperations) table).operations();\n      return ops.current().metadataFileLocation();\n    } else if (table instanceof BaseMetadataTable) {\n      return ((BaseMetadataTable) table).table().operations().current().metadataFileLocation();\n    } else {\n      return null;\n    }\n  }\n\n  private Table lazyTable() {\n    if (lazyTable == null) {","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/SerializableTable.java#L98-L134","documentation":"SerializableTable captures a table's state for serialization (e.g., sending to executors). It only records a metadata file location when built from a table whose TableOperations exposes one. Calling metadataFileLocation() on an instance built without one throws UnsupportedOperationException, since there is no metadata file path to return.","triggerScenarios":"Calling metadataFileLocation() on a SerializableTable created via SerializableTable.of() from a table whose operations did not provide a metadata file location (e.g., an in-memory/static table without a backing metadata file).","commonSituations":"Driver-side code inspecting a table after it was serialized for distributed execution; tables loaded via StaticTableOperations with a null metadata location.","solutions":["Check that the underlying table was loaded from a real catalog entry with a metadata file before serializing","Call metadataFileLocation() only on the original Table, not the SerializableTable wrapper","Re-read the table from its catalog to get a fresh instance with a metadata location"],"exampleFix":"// before\nSerializableTable st = SerializableTable.of(table);\nString loc = st.metadataFileLocation();\n// after\nString loc = table.operations().current().metadataFileLocation();","handlingStrategy":"type-guard","validationCode":"if (table instanceof SerializableTable) { throw new IllegalStateException(\"Call metadataFileLocation on the live table\"); }","typeGuard":"boolean hasMetadataLocation = !(table instanceof SerializableTable) || table.operations() != null;","tryCatchPattern":"try { loc = st.metadataFileLocation(); } catch (UnsupportedOperationException e) { loc = table.operations().current().metadataFileLocation(); }","preventionTips":["Fetch metadata location from the original Table/TableOperations, not the serialized wrapper","Only serialize catalog-loaded tables"],"tags":["iceberg","serialization","unsupported-operation"],"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"}