{"record":{"id":"9ac02677e3d8f3f8","repo":"alibaba/canal","slug":"parse-row-data-failed","errorCode":null,"errorMessage":"parse row data failed.","messagePattern":"parse row data failed\\.","errorType":"exception","errorClass":"CanalParseException","httpStatus":null,"severity":"error","filePath":"parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/dbsync/LogEventConvert.java","lineNumber":599,"sourceCode":"            }\n            TableMapLogEvent table = event.getTable();\n            Header header = createHeader(event.getHeader(),\n                table.getDbName(),\n                table.getTableName(),\n                eventType,\n                rowsCount);\n\n            RowChange rowChange = rowChangeBuider.build();\n            if (tableError) {\n                Entry entry = createEntry(header, EntryType.ROWDATA, ByteString.EMPTY);\n                logger.warn(\"table parser error : {}storeValue: {}\", entry.toString(), rowChange.toString());\n                return null;\n            } else {\n                Entry entry = createEntry(header, EntryType.ROWDATA, rowChange.toByteString());\n                return entry;\n            }\n        } catch (Exception e) {\n            throw new CanalParseException(\"parse row data failed.\", e);\n        }\n    }\n\n    private EntryPosition createPosition(LogHeader logHeader) {\n        return new EntryPosition(logHeader.getLogFileName(), logHeader.getLogPos() - logHeader.getEventLen(), // startPos\n            logHeader.getWhen() * 1000L,\n            logHeader.getServerId()); // 记录到秒\n    }\n\n    private boolean parseOneRow(RowData.Builder rowDataBuilder, RowsLogEvent event, RowsLogBuffer buffer, BitSet cols,\n                                boolean isAfter, TableMeta tableMeta) throws UnsupportedEncodingException {\n        int columnCnt = event.getTable().getColumnCnt();\n        ColumnInfo[] columnInfo = event.getTable().getColumnInfo();\n        // mysql8.0针对set @@global.binlog_row_metadata='FULL' 可以记录部分的metadata信息\n        boolean existOptionalMetaData = event.getTable().isExistOptionalMetaData();\n        boolean tableError = false;\n        // check table fileds count，只能处理加字段\n        boolean existRDSNoPrimaryKey = false;","sourceCodeStart":581,"sourceCodeEnd":617,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/dbsync/LogEventConvert.java#L581-L617","documentation":"Thrown from the catch(Exception) block of parseRowsEvent() — it is the generic catch-all wrapping any non-CanalParse exception that occurs during row data parsing. The original exception is attached as the cause. This covers charset decoding failures, RowsLogBuffer underflows, NumberFormatException on numeric columns, and other unexpected data-level errors.","triggerScenarios":"Any exception during the row-parsing loop (parseOneRow calls, buffer reads, column building) that is not caught locally bubbles up to the try/catch in parseRowsEvent(). The cause exception reveals the specific failure: UnsupportedEncodingException, IndexOutOfBoundsException from buffer underflow, or data type conversion errors.","commonSituations":"The canal.instance.charset setting doesn't match the actual table character set, causing decoding errors. A JSON/BLOB column contains data that overflows the expected buffer. A column type in the binlog doesn't match the table metadata (DDL changed columns but cache wasn't refreshed). Network corruption produced a truncated event.","solutions":["Examine the cause exception (e.getCause()) in the CanalParseException to identify the specific parsing failure.","Verify canal.instance.charset matches the database character set (commonly UTF-8).","If caused by column mismatches, enable TSDB (canal.instance.tsdb.enable=true) for accurate historical DDL tracking.","Enable filterTableError=true if the root cause is a stale table metadata mismatch."],"exampleFix":"# before\ncanal.instance.charset=UTF-8\ncanal.instance.tsdb.enable=false\n\n# after\ncanal.instance.charset=utf8mb4\ncanal.instance.tsdb.enable=true","handlingStrategy":"try-catch","validationCode":"// Verify charset configuration matches the database before starting\nResultSetPacket rs = mysqlConnection.query(\"SHOW VARIABLES LIKE 'character_set_database'\");\nString dbCharset = rs.getFieldValues().get(1);\nif (!dbCharset.equalsIgnoreCase(configuredCharset)) {\n    logger.warn(\"Charset mismatch: canal={}, db={}, row parsing may fail\", configuredCharset, dbCharset);\n}","typeGuard":null,"tryCatchPattern":"try {\n    Entry entry = parseRowsEvent(event);\n} catch (CanalParseException e) {\n    Throwable cause = e.getCause();\n    logger.error(\"Row parsing failed at position {}, cause: {}\",\n        event.getHeader().getLogPos(), cause != null ? cause.getMessage() : \"unknown\", e);\n    // Depending on cause type, skip the event or retry after metadata refresh\n}","preventionTips":["Match canal.instance.charset to the database's character_set_database value.","Enable TSDB for accurate column metadata to avoid parse mismatches.","Monitor the cause exception chain to distinguish charset issues from buffer underflows."],"tags":["mysql","binlog","row-parsing","charset","catch-all"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}