{"record":{"id":"24610b22f8ebc942","repo":"apache/iceberg","slug":"unknown-field-ordinal-24610b","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/GenericManifestFile.java","lineNumber":325,"sourceCode":"        return addedFilesCount;\n      case 8:\n        return existingFilesCount;\n      case 9:\n        return deletedFilesCount;\n      case 10:\n        return addedRowsCount;\n      case 11:\n        return existingRowsCount;\n      case 12:\n        return deletedRowsCount;\n      case 13:\n        return partitions();\n      case 14:\n        return keyMetadata();\n      case 15:\n        return firstRowId();\n      default:\n        throw new UnsupportedOperationException(\"Unknown field ordinal: \" + basePos);\n    }\n  }\n\n  @Override\n  protected <T> void internalSet(int basePos, T value) {\n    switch (basePos) {\n      case 0:\n        // always coerce to String for Serializable\n        this.manifestPath = value.toString();\n        return;\n      case 1:\n        this.length = (Long) value;\n        return;\n      case 2:\n        this.specId = (Integer) value;\n        return;\n      case 3:\n        this.content =","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/GenericManifestFile.java#L307-L343","documentation":"GenericManifestFile.getByPos supports ordinals 0-15 (manifest path through firstRowId) and throws UnsupportedOperationException('Unknown field ordinal: ' + basePos) for anything else. The basePos comes from internalGet, which maps projected positions to base positions; an unknown basePos means the projection references a field beyond the manifest file struct known to this class.","triggerScenarios":"Reading a ManifestFile struct with a projection containing a field ordinal > 15 — e.g. manifests written by a newer spec/version with extra fields, or a hand-built projection schema for the 'manifests'/'files' metadata tables.","commonSituations":"Version skew: newer writer, older reader; custom metadata-table SQL/projections referencing added columns like first_row_id before/after upgrade; third-party tools constructing ManifestFile projections manually.","solutions":["Upgrade the Iceberg runtime to match the version that wrote the manifest list (field count must be <= supported ordinals).","Regenerate the projection via the actual manifest file type (ManifestFile.getType(...)) instead of a hand-written schema.","Identify the reported basePos and compare against the 16 known fields to find the unexpected projection field."],"exampleFix":"// before\nSchema projection = new Schema(manifestFileType.fields()); // includes unknown new fields\n// after: project only supported fields\nSchema projection = new Schema(manifestFileType.fields().stream()\n    .filter(f -> f.fieldId() <= ManifestFile.FIRST_ROW_ID.fieldId())\n    .collect(Collectors.toList()));","handlingStrategy":"validation","validationCode":"int fieldCount = projection.asStructType().fields().size();\nif (fieldCount > 16) {\n  throw new IllegalArgumentException(\"Projection has \" + fieldCount + \" fields; reader supports at most 16\");\n}","typeGuard":"boolean isSupportedManifestFileOrdinal(int basePos) { return basePos >= 0 && basePos <= 15; }","tryCatchPattern":"try {\n  ManifestFile mf = manifestReader.read();\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"Unknown field ordinal\")) {\n    // rebuild projection from ManifestFile.getType(...) and/or upgrade Iceberg\n  } else throw e;\n}","preventionTips":["Build projections from ManifestFile.getType(spec) rather than hand-written schemas.","Keep the Iceberg reader version >= the writer version of manifest lists.","When new spec fields (e.g. first_row_id) appear, upgrade before projecting them."],"tags":["manifest-file","ordinal","unsupported-operation","projection"],"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"}