{"record":{"id":"25fce5b0bfd9fa61","repo":"apache/iceberg","slug":"unknown-field-ordinal-25fce5","errorCode":null,"errorMessage":"Unknown field ordinal: ","messagePattern":"Unknown field ordinal: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/GenericManifestEntry.java","lineNumber":199,"sourceCode":"  public <T> void set(int pos, T value) {\n    put(pos, value);\n  }\n\n  @Override\n  public Object get(int i) {\n    switch (i) {\n      case 0:\n        return status.id();\n      case 1:\n        return snapshotId;\n      case 2:\n        return dataSequenceNumber;\n      case 3:\n        return fileSequenceNumber;\n      case 4:\n        return file;\n      default:\n        throw new UnsupportedOperationException(\"Unknown field ordinal: \" + i);\n    }\n  }\n\n  @Override\n  public <T> T get(int pos, Class<T> javaClass) {\n    return javaClass.cast(get(pos));\n  }\n\n  @Override\n  public org.apache.avro.Schema getSchema() {\n    return schema;\n  }\n\n  @Override\n  public int size() {\n    return 5;\n  }\n","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/GenericManifestEntry.java#L181-L217","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Restrict positional access to 0-4 or look up ordinals from the manifest entry schema dynamically.","Upgrade Iceberg if the manifest files were written by a newer version with additional entry fields.","Validate the projected schema used by the ManifestReader matches the known entry fields before iterating."],"exampleFix":"// before: hardcoded index beyond the entry schema\nObject v = entry.get(7);\n// after: resolve index from the schema\nTypes.NestedField f = entrySchema.asStructType().field(\"file\");\nObject v = entry.get(entrySchema.asStructType().fields().indexOf(f));","handlingStrategy":"type-guard","validationCode":"if (i < 0 || i > 4) throw new IllegalArgumentException(\"Manifest entry ordinal out of range: \" + i);","typeGuard":"boolean isValidEntryOrdinal(int i) { return i >= 0 && i <= 4; }","tryCatchPattern":"try {\n  Object v = entry.get(i);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"Unknown field ordinal\")) {\n    // align the reader with the manifest entry schema or upgrade Iceberg\n  } else throw e;\n}","preventionTips":["Resolve entry field positions from the manifest entry schema, not constants.","Upgrade the runtime before reading manifests from newer writers.","Validate projected schemas in custom ManifestReader usage."],"tags":["manifest-entry","ordinal","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"}