{"record":{"id":"b32165ab2d840bc1","repo":"apache/seatunnel","slug":"common-02-b32165","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/ogg/OggJsonSerializationSchema.java","lineNumber":93,"sourceCode":"\n            if (mergeUpdateEventFlag && row.getRowKind() == RowKind.UPDATE_AFTER) {\n                reuse.setField(0, cacheUpdateBeforeRow);\n            } else {\n                reuse.setField(0, null);\n            }\n\n            reuse.setField(1, row);\n            reuse.setField(2, rowKind2String(row.getRowKind()));\n            if (!StringUtils.isEmpty(row.getTableId())) {\n                reuse.setField(3, row.getTableId());\n            }\n\n            if (row.getOptions() != null && row.getOptions().containsKey(EVENT_TIME.getName())) {\n                reuse.setField(4, row.getOptions().get(EVENT_TIME.getName()));\n            }\n            return jsonSerializer.serialize(reuse);\n        } catch (Throwable t) {\n            throw CommonError.jsonOperationError(FORMAT, row.toString(), t);\n        }\n    }\n\n    private String rowKind2String(RowKind rowKind) {\n        switch (rowKind) {\n            case INSERT:\n            case UPDATE_AFTER:\n                if (mergeUpdateEventFlag && rowKind.equals(RowKind.UPDATE_AFTER)) {\n                    return OP_UPDATE;\n                }\n                return OP_INSERT;\n            case UPDATE_BEFORE:\n            case DELETE:\n                return OP_DELETE;\n            default:\n                throw new SeaTunnelJsonFormatException(\n                        CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION,\n                        String.format(\"Unsupported operation %s for row kind.\", rowKind));","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/ogg/OggJsonSerializationSchema.java#L75-L111","documentation":"OggJsonSerializationSchema.serialize() wraps the entire row-to-JSON conversion in a catch-all that rethrows via CommonError.jsonOperationError. This is thrown when any failure occurs while converting a SeaTunnelRow (including setting c/z/o/op/ts fields) into its OGG-flavored JSON string via the underlying JsonSerializationSchema. The original cause is attached as the throwable's cause.","triggerScenarios":"Calling serialize(row) on a row whose schema/type doesn't match the declared SeaTunnelRowType (e.g. wrong field count, null in a non-nullable position, unsupported data type), or when the OGG JSON serializer hits an internal Jackson/serialization error. Observed raised from serialize() during a test run (runTest).","commonSituations":"Upstream CDC data (e.g. from an OGG message stream) contains types incompatible with the declared row schema; a null value written into a required field; mismatched SeaTunnelRow arity after schema evolution; malformed EVENT_TIME option value placement.","solutions":["Read the cause chain (t) printed with the error to find the real serialization failure (usually a type mismatch or null).","Verify the catalog table's SeaTunnelRowType exactly matches the data being serialized (field names, count, types).","Check for null fields where the schema expects non-null; sanitize or coalesce before serializing.","Upgrade/check version compatibility between the OggJson format and the connector producing rows.","Reproduce locally with the failing row (row.toString() appears in the message) and run through the serializer in a unit test."],"exampleFix":"// before\nrow.setField(3, null); // nullable field not declared nullable\nreturn schema.serialize(row); // throws jsonOperationError\n// after\nif (value == null) {\n    value = \"\"; // or skip / use default per schema\n}\nrow.setField(3, value);\nreturn schema.serialize(row);","handlingStrategy":"try-catch","validationCode":"if (row == null || row.getArity() != rowType.getTotalFields()) {\n    throw new IllegalArgumentException(\"Row arity mismatch: expected \" + rowType.getTotalFields());\n}\nfor (int i = 0; i < row.getArity(); i++) {\n    if (row.getField(i) == null && !rowType.getFieldType(i).nullable()) {\n        throw new IllegalArgumentException(\"Null in non-nullable field \" + i);\n    }\n}","typeGuard":"boolean isSerializableRow(SeaTunnelRow row, SeaTunnelRowType type) {\n    return row != null && row.getArity() == type.getTotalFields();\n}","tryCatchPattern":"try {\n    byte[] json = schema.serialize(row);\n} catch (Exception e) {\n    log.error(\"OGG JSON serialize failed for row: {}\", row, e);\n    // route to dead-letter / skip\n}","preventionTips":["Validate row arity and field types against the declared SeaTunnelRowType before serializing","Handle nulls explicitly before serialization","Keep format plugin version aligned with the connector version","Unit-test the serializer with representative rows from the source"],"tags":["json","serialization","cdc","ogg"],"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-14T11:17:12.474Z"}