apache/iceberg · error · UnsupportedOperationException

Unknown field ordinal:

Error message

Unknown field ordinal: 

What it means

GenericManifestEntry.get maps ordinals 0-4 (status, snapshotId, dataSequenceNumber, fileSequenceNumber, file) to entry values; any other ordinal throws UnsupportedOperationException('Unknown field ordinal: ' + i). Access is only valid for the five fields of the manifest-entry struct, so a foreign ordinal means the accessor is not aligned with the manifest entry schema.

Source

Thrown at core/src/main/java/org/apache/iceberg/GenericManifestEntry.java:199

  public <T> void set(int pos, T value) {
    put(pos, value);
  }

  @Override
  public Object get(int i) {
    switch (i) {
      case 0:
        return status.id();
      case 1:
        return snapshotId;
      case 2:
        return dataSequenceNumber;
      case 3:
        return fileSequenceNumber;
      case 4:
        return file;
      default:
        throw new UnsupportedOperationException("Unknown field ordinal: " + i);
    }
  }

  @Override
  public <T> T get(int pos, Class<T> javaClass) {
    return javaClass.cast(get(pos));
  }

  @Override
  public org.apache.avro.Schema getSchema() {
    return schema;
  }

  @Override
  public int size() {
    return 5;
  }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Restrict positional access to 0-4 or look up ordinals from the manifest entry schema dynamically.
  2. Upgrade Iceberg if the manifest files were written by a newer version with additional entry fields.
  3. Validate the projected schema used by the ManifestReader matches the known entry fields before iterating.

Example fix

// before: hardcoded index beyond the entry schema
Object v = entry.get(7);
// after: resolve index from the schema
Types.NestedField f = entrySchema.asStructType().field("file");
Object v = entry.get(entrySchema.asStructType().fields().indexOf(f));
Defensive patterns

Strategy: type-guard

Validate before calling

if (i < 0 || i > 4) throw new IllegalArgumentException("Manifest entry ordinal out of range: " + i);

Type guard

boolean isValidEntryOrdinal(int i) { return i >= 0 && i <= 4; }

Try / catch

try {
  Object v = entry.get(i);
} catch (UnsupportedOperationException e) {
  if (e.getMessage().startsWith("Unknown field ordinal")) {
    // align the reader with the manifest entry schema or upgrade Iceberg
  } else throw e;
}

Prevention

When it happens

Trigger: Calling get(i) with i outside 0..4, typically when reading manifest entries with a projection that includes fields the reader's struct implementation does not support (version skew between manifest file schema and code, or custom positional accessors).

Common situations: Reading manifests written by a newer Iceberg with extended entry fields using an older runtime; custom scan-planning code iterating entry fields by hardcoded positions; schema-projection mismatches in metadata table readers.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/25fce5b0bfd9fa61. Report an issue: GitHub.