{"record":{"id":"01b28abe86de3507","repo":"apache/seatunnel","slug":"common-02-01b28a","errorCode":"COMMON-02","errorMessage":"Json JSON convert/parse '<payload>' operation failed.","messagePattern":"Json JSON convert/parse '<payload>' operation failed\\.","errorType":"error_code","errorClass":"SeaTunnelRuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/debezium/DebeziumJsonSerializationSchema.java","lineNumber":120,"sourceCode":"                        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                });\n    }\n}\n","sourceCodeStart":102,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/debezium/DebeziumJsonSerializationSchema.java#L102-L136","documentation":"DebeziumJsonSerializationSchema.serialize wraps any Throwable from mapping a SeaTunnelRow to the Debezium JSON envelope (before/after/op/source/ts_ms) into jsonOperationError. The offending row's toString is embedded. It means the row's RowKind, arity, or field types are incompatible with the Debezium envelope the serializer builds.","triggerScenarios":"serialize(SeaTunnelRow) hits the UnsupportedOperationException for unsupported RowKind, or Jackson fails serializing field values, or the row's field count differs from createJsonRowType's expected schema (before, after, op, source, ts_ms).","commonSituations":"Sink receives DELETE/UPDATE rows while configured schema only supports INSERT; upstream transforms producing wrong arity rows; byte[] or custom-typed fields Jackson cannot serialize; RowKind like TRUNCATE not handled.","solutions":["Check the row's RowKind in row.toString(); use a RowKindConverter/filter so only supported kinds (INSERT/UPDATE_AFTER/DELETE) reach the sink","Ensure the upstream row arity and field types match the Debezium JSON row type built from the database schema","Convert non-JSON-serializable fields (e.g. byte[], nested maps) to supported types upstream","Reproduce in testSerializationDeserialization with the failing row and fix the producer accordingly"],"exampleFix":"// before: TRUNCATE RowKind reaches Debezium sink -> Unsupported operation\nrow.setRowKind(RowKind.TRUNCATE);\n// after: filter unsupported kinds before sink\nif (row.getRowKind() == RowKind.TRUNCATE) return; // or map to DELETE","handlingStrategy":"validation","validationCode":"Set<RowKind> supported = Set.of(RowKind.INSERT, RowKind.UPDATE_AFTER, RowKind.DELETE);\nif (!supported.contains(row.getRowKind())) {\n    throw new IllegalArgumentException(\"Unsupported RowKind \" + row.getRowKind());\n}","typeGuard":"boolean hasSupportedRowKind(SeaTunnelRow row) {\n    RowKind k = row == null ? null : row.getRowKind();\n    return k == RowKind.INSERT || k == RowKind.UPDATE_AFTER || k == RowKind.DELETE;\n}","tryCatchPattern":"try {\n    byte[] out = serializer.serialize(row);\n} catch (SeaTunnelRuntimeException e) {\n    log.error(\"Debezium serialize failed for row {}\", row, e);\n    throw e;\n}","preventionTips":["Filter RowKinds unsupported by Debezium sink before serialize","Keep row arity equal to before/after/op/source/ts_ms schema","Convert byte[]/custom fields to JSON-friendly types upstream","Test serialization per RowKind in unit tests"],"tags":["json","serialization","debezium","schema"],"backgroundTag":"json-serialization-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}