{"record":{"id":"8e804ffa5214291e","repo":"apache/iceberg","slug":"unknown-row-kind-8e804f","errorCode":null,"errorMessage":"Unknown row kind: ","messagePattern":"Unknown row kind: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/BaseDeltaTaskWriter.java","lineNumber":109,"sourceCode":"        break;\n\n      case UPDATE_BEFORE:\n        if (upsert) {\n          break; // UPDATE_BEFORE is not necessary for UPSERT, we do nothing to prevent delete one\n          // row twice\n        }\n        writer.delete(row);\n        break;\n      case DELETE:\n        if (upsert) {\n          writer.deleteKey(keyProjection.wrap(row));\n        } else {\n          writer.delete(row);\n        }\n        break;\n\n      default:\n        throw new UnsupportedOperationException(\"Unknown row kind: \" + row.getRowKind());\n    }\n  }\n\n  protected class RowDataDeltaWriter extends BaseEqualityDeltaWriter {\n    RowDataDeltaWriter(PartitionKey partition, PartitioningDVWriter<RowData> dvFileWriter) {\n      super(partition, schema, deleteSchema, DeleteGranularity.FILE, dvFileWriter);\n    }\n\n    @Override\n    protected StructLike asStructLike(RowData data) {\n      return wrapper.wrap(data);\n    }\n\n    @Override\n    protected StructLike asStructLikeKey(RowData data) {\n      return keyWrapper.wrap(data);\n    }\n  }","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/BaseDeltaTaskWriter.java#L91-L127","documentation":"BaseDeltaTaskWriter.write() dispatches RowData by RowKind: INSERT/UPDATE_AFTER go to the data writer, DELETE/UPDATE_BEFORE go to the delete writer. Any other RowKind cannot be written to Iceberg and triggers UnsupportedOperationException naming the kind.","triggerScenarios":"Writing a RowData whose getRowKind() is not INSERT, UPDATE_AFTER, DELETE, or UPDATE_BEFORE — only possible with RowKind not produced by normal Flink changelog semantics, or when upstream code constructs RowData with a custom/invalid kind byte.","commonSituations":"Custom upstream operators building RowData and setting a wrong/unknown RowKind byte; corruption when translating records from another source; hand-crafted test/generic records with kind 0 (unknown).","solutions":["Inspect the record's RowKind in the upstream operator and ensure it's set to one of INSERT, UPDATE_BEFORE, UPDATE_AFTER, DELETE","Fix the producer emitting records with an invalid RowKind byte (custom serialization/deserialization bugs)","If intentionally dropping rows, filter them before the sink instead of sending unknown kinds","Validate changelog mode of the upstream: rows must come from a to-changelog stream with proper kinds"],"exampleFix":"// before\ngeneric.setRowKind(RowKind.fromByteValue((byte) 9)); // unknown kind -> UnsupportedOperationException\n// after\ngeneric.setRowKind(RowKind.INSERT);","handlingStrategy":"validation","validationCode":"// before the sink\nDataStream<RowData> validated = stream.filter(r ->\n    r.getRowKind() == RowKind.INSERT || r.getRowKind() == RowKind.UPDATE_AFTER ||\n    r.getRowKind() == RowKind.UPDATE_BEFORE || r.getRowKind() == RowKind.DELETE);","typeGuard":"static boolean isWritableRowKind(RowData row) {\n  switch (row.getRowKind()) {\n    case INSERT:\n    case UPDATE_AFTER:\n    case UPDATE_BEFORE:\n    case DELETE:\n      return true;\n    default:\n      return false;\n  }\n}","tryCatchPattern":"try {\n  writer.write(row);\n} catch (UnsupportedOperationException e) {\n  LOG.error(\"Row with unsupported RowKind {} reached the Iceberg sink\", row.getRowKind(), e);\n  throw e;\n}","preventionTips":["Ensure upstream operators only emit the four standard RowKinds","Filter out unknown-kind records before the Iceberg sink","Check custom RowData implementations for corrupted kind bytes"],"tags":["flink","sink","rowkind","unsupported-operation"],"backgroundTag":"unsupported-enum-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}