{"record":{"id":"214d931e91a428de","repo":"apache/iceberg","slug":"unknown-field-ordinal-i-214d93","errorCode":null,"errorMessage":"Unknown field ordinal: ${i}","messagePattern":"Unknown field ordinal: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"kafka-connect/kafka-connect-events/src/main/java/org/apache/iceberg/connect/events/CommitToTable.java","lineNumber":140,"sourceCode":"        return;\n      default:\n        // ignore the object, it must be from a newer version of the format\n    }\n  }\n\n  @Override\n  public Object get(int i) {\n    switch (AvroUtil.positionToId(i, avroSchema)) {\n      case COMMIT_ID:\n        return commitId;\n      case TABLE_REFERENCE:\n        return tableReference;\n      case SNAPSHOT_ID:\n        return snapshotId;\n      case VALID_THROUGH_TS:\n        return validThroughTs == null ? null : DateTimeUtil.microsFromTimestamptz(validThroughTs);\n      default:\n        throw new UnsupportedOperationException(\"Unknown field ordinal: \" + i);\n    }\n  }\n}\n","sourceCodeStart":122,"sourceCodeEnd":144,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/kafka-connect/kafka-connect-events/src/main/java/org/apache/iceberg/connect/events/CommitToTable.java#L122-L144","documentation":"CommitToTable is an Avro-record event carrying a tableReference, snapshotId and validThroughTs; its StructLike get(i) resolves a field ordinal from the Avro schema to one of these values. An ordinal outside the known COMMIT-TO-TABLE fields throws UnsupportedOperationException('Unknown field ordinal'). This indicates the event's Avro schema layout does not match what this reader version expects.","triggerScenarios":"Deserializing a CommitToTable event whose Avro schema has fields in a different order or extra/missing fields relative to the reader's schema — version skew between the event producer and consumer, or a schema registry entry that drifted from the code.","commonSituations":"Rolling upgrades of Kafka Connect iceberg sink workers with different Iceberg versions; replaying old commit events with a new reader; custom builds where the event schema was modified.","solutions":["Use the same iceberg-kafka-connect-events version on producers and consumers.","Check the schema used to write the event (registry entry or embedded schema) matches CommitToTable's expected fields in order.","Re-serialize/replay historical events with the matching writer version if they predate a schema change.","Pin the Iceberg version in all Connect worker configs to avoid mixed-version deserialization."],"exampleFix":"// before\n// worker A: iceberg 1.4, worker B: iceberg 1.6 (mixed commit-event schemas)\n// after\n// both workers: iceberg 1.6 in connect-mirror-worker.properties:\n// iceberg.version=1.6.0","handlingStrategy":"try-catch","validationCode":"// check embedded writer schema against expected field names/order\nList<String> names = writerSchema.getFields().stream()\n    .map(f -> f.name()).collect(Collectors.toList());\nif (!names.equals(List.of(\"tableReference\", \"snapshotId\", \"validThroughTs\"))) {\n  throw new IllegalStateException(\"CommitToTable schema drift: \" + names);\n}","typeGuard":null,"tryCatchPattern":"try {\n  deserializeCommitToTable(record);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"Unknown field ordinal\")) {\n    // replay with reader matching the writer's Iceberg version, or skip to DLQ\n    deadLetter(record, e);\n  } else throw e;\n}","preventionTips":["Use one Iceberg version across all Kafka Connect workers","Never manually reorder or remove fields in event Avro schemas","Cover event deserialization in upgrade integration tests","Replay historical events with the writer-era reader version"],"tags":["kafka-connect","avro","schema","serialization"],"backgroundTag":"schema-version-mismatch","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}