{"record":{"id":"387dbc3bf90ed69d","repo":"apache/iceberg","slug":"unknown-row-kind","errorCode":null,"errorMessage":"Unknown row kind: ","messagePattern":"Unknown row kind: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/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.1/flink/src/main/java/org/apache/iceberg/flink/sink/BaseDeltaTaskWriter.java#L91-L127","documentation":"BaseDeltaTaskWriter.write() dispatches RowData based on the row's RowKind: INSERT rows go to the upsert/append writer, and UPDATE_BEFORE/UPDATE_AFTER/DELETE rows route to delete handling. Any other RowKind reaches the default branch, which throws this UnsupportedOperationException because the writer cannot interpret the row's change semantics.","triggerScenarios":"Feeding a RowData with an unexpected RowKind into an Iceberg Flink sink (e.g. a corrupted stream record or a new RowKind value from a newer Flink version) via write(), or through equality/position delete writer paths like writeDeleteFile and writePosDeleteFile.","commonSituations":"Custom Flink operators producing rows with fabricated RowKinds; Flink version upgrades introducing new RowKind constants; malformed CDC streams where a changelog record's kind byte was corrupted in transit.","solutions":["Verify the upstream operator emits only valid RowKind values (INSERT, UPDATE_BEFORE, UPDATE_AFTER, DELETE) for CDC streams.","Ensure the sink input is a proper changelog stream (to changelogStream / upsert mode) matching the data's RowKinds.","Align Flink and Iceberg runtime versions so RowKind is interpreted consistently.","Filter or sanitize invalid records upstream before the sink."],"exampleFix":"// before\nstream.map(row -> RowDataUtil.setKind(row, (byte) 7));\n// after\nstream.map(row -> RowDataUtil.setKind(row, RowKind.INSERT));","handlingStrategy":"validation","validationCode":"RowKind kind = row.getRowKind();\nif (kind != RowKind.INSERT && kind != RowKind.UPDATE_BEFORE && kind != RowKind.UPDATE_AFTER && kind != RowKind.DELETE) {\n  throw new IllegalArgumentException(\"Invalid RowKind before sink: \" + kind);\n}","typeGuard":"boolean hasValidRowKind(RowData row) {\n  switch (row.getRowKind()) {\n    case INSERT:\n    case UPDATE_BEFORE:\n    case UPDATE_AFTER:\n    case DELETE:\n      return true;\n    default:\n      return false;\n  }\n}","tryCatchPattern":"try { sinkWrite(row); } catch (UnsupportedOperationException e) { LOG.error(\"Row with unhandled RowKind {}; drop or route to DLQ\", row.getRowKind(), e); }","preventionTips":["Feed the sink a proper changelog stream (RowKind-bearing) rather than append-only data fabricated with kinds.","Sanitize or drop rows with non-standard RowKind in an upstream operator.","Keep Flink and Iceberg versions aligned so RowKind enums match."],"tags":["flink","cdc","rowdata","unsupported-row-kind","sink"],"backgroundTag":"invalid-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"}