{"record":{"id":"7f8fdf05d92e9b28","repo":"apache/seatunnel","slug":"unsupported-operation-7f8fdf","errorCode":"UNSUPPORTED_OPERATION","errorMessage":"Unsupported operation %s for row kind.","messagePattern":"Unsupported operation (.+?) for row kind\\.","errorType":"error_code","errorClass":"SeaTunnelJsonFormatException","httpStatus":null,"severity":"error","filePath":"seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/maxwell/MaxWellJsonSerializationSchema.java","lineNumber":111,"sourceCode":"            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));\n        }\n    }\n\n    private static SeaTunnelRowType createJsonRowType(SeaTunnelRowType databaseSchema) {\n        return new SeaTunnelRowType(\n                new String[] {\"old\", \"data\", \"type\", \"database\", \"table\", \"ts\"},\n                new SeaTunnelDataType[] {\n                    databaseSchema, databaseSchema, STRING_TYPE, STRING_TYPE, STRING_TYPE, LONG_TYPE\n                });\n    }\n}\n","sourceCodeStart":93,"sourceCodeEnd":125,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/maxwell/MaxWellJsonSerializationSchema.java#L93-L125","documentation":"MaxWellJsonSerializationSchema.rowKind2String maps a SeaTunnelRow's RowKind to a Maxwell operation string (insert/delete). RowKinds outside INSERT / UPDATE_BEFORE / DELETE (e.g. UPDATE_AFTER) fall to the default branch and throw UNSUPPORTED_OPERATION, because Maxwell JSON has no representation for that operation.","triggerScenarios":"serialize() is called with a SeaTunnelRow whose RowKind is e.g. UPDATE_AFTER — typical when a transform or upstream source emits row kinds the Maxwell serializer never anticipated into a sink configured with format=maxwell-json.","commonSituations":"Chaining a CDC source (which emits UPDATE_BEFORE/UPDATE_AFTER pairs) directly to a Maxwell-JSON sink; transforms that change row kind; custom connectors producing unusual row kinds.","solutions":["Insert a transform or use a sink format that supports update events (e.g. canal-json/debezium-json output)","Coalesce update pairs before the sink so rows are INSERT or DELETE kinds only","Check the upstream source configuration to avoid emitting unsupported RowKinds into this sink","If Maxwell-JSON must be used, pre-convert updates to delete+insert manually"],"exampleFix":"// before: CDC source (update pairs) -> MaxwellJson sink => throw\n// after: use a format that models updates\nsink {\n  Kafka {\n    format = canal-json\n  }\n}","handlingStrategy":"type-guard","validationCode":"if (row.getRowKind() != RowKind.INSERT && row.getRowKind() != RowKind.UPDATE_BEFORE && row.getRowKind() != RowKind.DELETE) {\n    throw new IllegalArgumentException(\"RowKind \" + row.getRowKind() + \" not serializable as maxwell-json\");\n}","typeGuard":"boolean isMaxwellSerializable(RowKind kind) {\n    return kind == RowKind.INSERT || kind == RowKind.UPDATE_BEFORE || kind == RowKind.DELETE;\n}","tryCatchPattern":"try {\n    serializer.serialize(row, out);\n} catch (SeaTunnelJsonFormatException e) {\n    log.error(\"Row kind not representable in maxwell json: {}\", e.getMessage());\n    throw e;\n}","preventionTips":["Don't wire update-emitting CDC sources directly to maxwell-json sinks","Use canal-json/debezium-json sink formats when updates must be represented","Coalesce update pairs upstream (e.g. via deduplicate/transform)"],"tags":["serialization","maxwell","row-kind","cdc"],"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"}