{"record":{"id":"ca83c780d823fdb6","repo":"apache/flink","slug":"unsupported-operation-s-for-row-kind-ca83c7","errorCode":null,"errorMessage":"Unsupported operation '%s' for row kind.","messagePattern":"Unsupported operation '(.+?)' for row kind\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/canal/CanalJsonSerializationSchema.java","lineNumber":102,"sourceCode":"            ArrayData arrayData = new GenericArrayData(new RowData[] {row});\n            reuse.setField(0, arrayData);\n            reuse.setField(1, opType);\n            return jsonSerializer.serialize(reuse);\n        } catch (Throwable t) {\n            throw new RuntimeException(\"Could not serialize row '\" + row + \"'.\", t);\n        }\n    }\n\n    private StringData rowKind2String(RowKind rowKind) {\n        switch (rowKind) {\n            case INSERT:\n            case UPDATE_AFTER:\n                return OP_INSERT;\n            case UPDATE_BEFORE:\n            case DELETE:\n                return OP_DELETE;\n            default:\n                throw new UnsupportedOperationException(\n                        \"Unsupported operation '\" + rowKind + \"' for row kind.\");\n        }\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        CanalJsonSerializationSchema that = (CanalJsonSerializationSchema) o;\n        return Objects.equals(jsonSerializer, that.jsonSerializer);\n    }\n\n    @Override\n    public int hashCode() {","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/canal/CanalJsonSerializationSchema.java#L84-L120","documentation":"Thrown by CanalJsonSerializationSchema.rowKind2String when the row's RowKind is not INSERT, UPDATE_AFTER, UPDATE_BEFORE, or DELETE. Canal-JSON can only express INSERT ('INSERT') and DELETE ('DELETE') operations, so other row kinds have no mapping. Standard Flink RowKinds never hit this; it requires a custom or unusual RowKind value.","triggerScenarios":"A RowData carrying a RowKind outside the four standard kinds — e.g. a custom RowKind created via new RowKind(short) or an edit stream with additional verbs — being serialized with format 'canal-json'.","commonSituations":"Custom RowKind definitions in advanced CDC pipelines; upstream edit streams mapping extra verbs (truncate, upsert-special) onto nonstandard kinds; library code reusing RowKind ordinals incompatibly across versions.","solutions":["Normalize RowKinds to the four standard kinds before the canal-json sink (e.g. map truncate to DELETE+INSERT pairs or filter)","If custom verbs are required, switch the sink format to one that carries richer metadata (changelog-json style or raw JSON with a verb column)","Guard the sink with a filter/mapping function that rejects or converts nonstandard kinds"],"exampleFix":"// before: custom kind flows into canal-json sink\nRowData out = new GenericRowData(RowKind.of((short) 5), ...); // nonstandard\n\n// after: normalize to a supported kind first\nRowData out = new GenericRowData(RowKind.DELETE, ...);","handlingStrategy":"validation","validationCode":"RowKind k = row.getRowKind();\nif (k != RowKind.INSERT && k != RowKind.UPDATE_BEFORE && k != RowKind.UPDATE_AFTER && k != RowKind.DELETE) {\n    throw new IllegalArgumentException(\"canal-json cannot encode \" + k);\n}","typeGuard":"static boolean canalEncodable(RowKind k) {\n    return k == RowKind.INSERT || k == RowKind.UPDATE_BEFORE\n        || k == RowKind.UPDATE_AFTER || k == RowKind.DELETE;\n}","tryCatchPattern":null,"preventionTips":["Never create custom RowKind values feeding canal-json","Map extra verbs to the four standard kinds upstream"],"tags":["canal","cdc","row-kind","serialization"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}