{"record":{"id":"ef707460be5befca","repo":"apache/iceberg","slug":"does-not-have-a-format-version","errorCode":null,"errorMessage":" does not have a format version","messagePattern":" does not have a format version","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/SerializableTable.java","lineNumber":173,"sourceCode":"\n  @Override\n  public String name() {\n    return name;\n  }\n\n  @Override\n  public String location() {\n    return location;\n  }\n\n  @Override\n  public Map<String, String> properties() {\n    return properties;\n  }\n\n  public int formatVersion() {\n    if (formatVersion == UNKNOWN_FORMAT_VERSION) {\n      throw new UnsupportedOperationException(\n          this.getClass().getName() + \" does not have a format version\");\n    }\n    return formatVersion;\n  }\n\n  private int formatVersion(Table table) {\n    try {\n      return TableUtil.formatVersion(table);\n    } catch (IllegalArgumentException e) {\n      return UNKNOWN_FORMAT_VERSION;\n    }\n  }\n\n  @Override\n  public Schema schema() {\n    if (lazySchema == null) {\n      synchronized (this) {\n        if (lazySchema == null && lazyTable == null) {","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/SerializableTable.java#L155-L191","documentation":"SerializableTable records the table's format version at serialization time. If the version was unknown (UNKNOWN_FORMAT_VERSION, e.g., the source TableOperations did not expose it), formatVersion() throws UnsupportedOperationException naming the concrete class.","triggerScenarios":"Calling formatVersion() on a SerializableTable that was built from a table whose format version could not be captured (unknown format version sentinel).","commonSituations":"Reading format version from a table deserialized without version info; custom/in-memory TableOperations implementations not reporting the version.","solutions":["Read the format version from the underlying TableMetadata before serializing","Ensure the table is loaded from a catalog so its metadata includes the format version","Guard with a check against SerializableTable.UNKNOWN_FORMAT_VERSION-equivalent state before calling"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if (table instanceof SerializableTable) { /* format version may be unknown */ } else { int v = table.operations().current().formatVersion(); }","typeGuard":"boolean hasFormatVersion = !(table instanceof SerializableTable);","tryCatchPattern":"try { v = st.formatVersion(); } catch (UnsupportedOperationException e) { v = MetadataTableUtils...; }","preventionTips":["Read format version from TableMetadata before serializing","Serialize only 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"}