{"record":{"id":"689ccbd57566e12f","repo":"apache/seatunnel","slug":"unsupported-operation-s-for-row-kind","errorCode":null,"errorMessage":"Unsupported operation '%s' for row kind.","messagePattern":"Unsupported operation '(.+?)' for row kind\\.","errorType":"error_code","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/debezium/DebeziumJsonSerializationSchema.java","lineNumber":115,"sourceCode":"                    }\n                    return jsonSerializer.serialize(genericRow);\n                case UPDATE_BEFORE:\n                    if (mergeUpdateEventFlag) {\n                        cacheUpdateBeforeRow = row;\n                        return null;\n                    }\n                case DELETE:\n                    genericRow.setField(0, row);\n                    genericRow.setField(1, null);\n                    genericRow.setField(2, OP_DELETE);\n                    genericRow.setField(3, source);\n                    if (row.getOptions() != null\n                            && row.getOptions().containsKey(EVENT_TIME.getName())) {\n                        genericRow.setField(4, row.getOptions().get(EVENT_TIME.getName()));\n                    }\n                    return jsonSerializer.serialize(genericRow);\n                default:\n                    throw new UnsupportedOperationException(\n                            String.format(\n                                    \"Unsupported operation '%s' for row kind.\", row.getRowKind()));\n            }\n        } catch (Throwable t) {\n            throw CommonError.jsonOperationError(FORMAT, row.toString(), t);\n        }\n    }\n\n    private static SeaTunnelRowType createJsonRowType(SeaTunnelRowType databaseSchema) {\n        return new SeaTunnelRowType(\n                new String[] {\"before\", \"after\", \"op\", \"source\", \"ts_ms\"},\n                new SeaTunnelDataType[] {\n                    databaseSchema,\n                    databaseSchema,\n                    STRING_TYPE,\n                    new MapType<>(BasicType.STRING_TYPE, BasicType.STRING_TYPE),\n                    LONG_TYPE\n                });","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/debezium/DebeziumJsonSerializationSchema.java#L97-L133","documentation":"DebeziumJsonSerializationSchema converts a SeaTunnelRow to Debezium-envelope JSON by switching on row.getRowKind(); supported kinds are mapped to Debezium 'op' values. An unsupported RowKind (commonly null or an unexpected kind) falls into the default branch and throws UnsupportedOperationException, then gets wrapped by CommonError.jsonOperationError.","triggerScenarios":"Calling serialize(row) on a row whose RowKind is not one of the kinds the schema maps (e.g. RowKind never set, or a kind added in newer SeaTunnel versions not handled here). The existing SOURCE shows it reachable from testSerializationDeserialization with such a row.","commonSituations":"Rows from custom sources without setRowKind; new RowKind values introduced upstream that the serializer's switch does not cover; test fixtures constructing rows with default/null RowKind.","solutions":["Set a supported RowKind on every row before serialization (INSERT, UPDATE_BEFORE/UPDATE_AFTER, DELETE)","Extend the serializer's switch if a new RowKind must be supported and rebuild the format module","Log row.getRowKind() and the row contents (already embedded in the jsonOperationError message) to locate the producer","Pin format and engine versions so RowKind enums match"],"exampleFix":"// before\nSeaTunnelRow row = new SeaTunnelRow(2); // RowKind null -> default branch throws\n// after\nrow.setRowKind(RowKind.INSERT);\nbyte[] json = serializer.serialize(row);","handlingStrategy":"validation","validationCode":"RowKind kind = row.getRowKind();\nif (kind == null) throw new IllegalArgumentException(\"RowKind must be set before Debezium serialization\");","typeGuard":"boolean isDebeziumSerializable(SeaTunnelRow row) {\n    RowKind k = row != null ? row.getRowKind() : null;\n    return k != null; // extend to the explicit set of kinds the serializer supports\n}","tryCatchPattern":"try {\n    byte[] json = serializer.serialize(row);\n} catch (UnsupportedOperationException e) {\n    log.error(\"Cannot serialize row kind {} to Debezium JSON\", row.getRowKind(), e);\n    throw e;\n}","preventionTips":["Set RowKind explicitly on all rows destined for Debezium-format sinks","Add serialization tests covering every supported RowKind","Review the serializer's switch when adding new RowKind values upstream"],"tags":["cdc","debezium","rowkind","serialization"],"backgroundTag":"unsupported-operation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}