{"record":{"id":"b7e5a091581ede04","repo":"apache/beam","slug":"unsupported-cdc-valuekind","errorCode":null,"errorMessage":"Unsupported CDC ValueKind: {}","messagePattern":"Unsupported CDC ValueKind: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/cdc/CdcOutputUtils.java","lineNumber":192,"sourceCode":"    }\n    if (dataAndRowMetadata.getSchema().hasField(metadataColumn)) {\n      return dataAndRowMetadata.getValue(metadataColumn);\n    }\n    return null;\n  }\n\n  private static ChangelogOperation changelogOperation(ValueKind valueKind) {\n    switch (valueKind) {\n      case INSERT:\n        return ChangelogOperation.INSERT;\n      case DELETE:\n        return ChangelogOperation.DELETE;\n      case UPDATE_BEFORE:\n        return ChangelogOperation.UPDATE_BEFORE;\n      case UPDATE_AFTER:\n        return ChangelogOperation.UPDATE_AFTER;\n      default:\n        throw new IllegalArgumentException(\"Unsupported CDC ValueKind: \" + valueKind);\n    }\n  }\n}\n","sourceCodeStart":174,"sourceCodeEnd":196,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/cdc/CdcOutputUtils.java#L174-L196","documentation":"CdcOutputUtils.changelogOperation maps a CDC ValueKind enum to the Iceberg ChangelogOperation written into the output metadata. The mapping covers INSERT, DELETE, UPDATE_BEFORE and UPDATE_AFTER; any other ValueKind has no defined mapping and throws IllegalArgumentException.","triggerScenarios":"A CDC record whose ValueKind is not one of the four enumerated kinds (e.g. a new/truncated kind added upstream, or a corrupted/unknown enum ordinal deserialized from the source) flows into changelogOperation via metadataValue.","commonSituations":"Version skew between the CDC producer writing ValueKind and the Beam Iceberg CDC library reading it; hand-crafted or corrupted input records feeding the transform; schema/enum evolution upstream.","solutions":["Upgrade the Beam Iceberg CDC library to a version whose enum mapping matches the producer's ValueKind set.","Sanitize/normalize input records upstream so only INSERT/DELETE/UPDATE_BEFORE/UPDATE_AFTER reach the transform.","Log and drop or dead-letter unknown ValueKind records in a pre-transform instead of letting them fail the pipeline.","Check the source connector (e.g. Debezium op codes) mapping to ensure it does not emit unhandled kinds."],"exampleFix":"// before\nrecords.apply(CdcOutputUtils.toIcebergChangelog(...)); // producer emits TRUNCATE kind\n// after\nrecords.apply(\"filter-kinds\", Filter.by(r ->\n    EnumSet.of(ValueKind.INSERT, ValueKind.DELETE, ValueKind.UPDATE_BEFORE, ValueKind.UPDATE_AFTER)\n        .contains(r.getKind())))\n  .apply(CdcOutputUtils.toIcebergChangelog(...));","handlingStrategy":"validation","validationCode":"Set<ValueKind> allowed = EnumSet.of(ValueKind.INSERT, ValueKind.DELETE, ValueKind.UPDATE_BEFORE, ValueKind.UPDATE_AFTER);\nif (!allowed.contains(record.getKind())) {\n  throw new IllegalArgumentException(\"Unmapped ValueKind: \" + record.getKind());\n}","typeGuard":"boolean isKnownKind(ValueKind k) {\n  return k == ValueKind.INSERT || k == ValueKind.DELETE || k == ValueKind.UPDATE_BEFORE || k == ValueKind.UPDATE_AFTER;\n}","tryCatchPattern":"try {\n  records.apply(CdcOutputUtils.toIcebergChangelog(...));\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unsupported CDC ValueKind\")) {\n    // route record to dead-letter and continue\n  } else { throw e; }\n}","preventionTips":["Filter to known ValueKinds before the transform.","Keep producer and Beam CDC library versions aligned.","Dead-letter unmapped kinds instead of failing the pipeline."],"tags":["java","iceberg","cdc","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}