{"record":{"id":"0c72c81d185b33ed","repo":"alibaba/canal","slug":"unknown-blob-packlen","errorCode":null,"errorMessage":"!! Unknown BLOB packlen = ","messagePattern":"!! Unknown BLOB packlen = ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsLogBuffer.java","lineNumber":983,"sourceCode":"                        byte[] binary = new byte[len24];\r\n                        buffer.fillBytes(binary, 0, len24);\r\n                        value = binary;\r\n                        javaType = Types.LONGVARBINARY;\r\n                        length = len24;\r\n                        break;\r\n                    }\r\n                    case 4: {\r\n                        /* LONGBLOB/LONGTEXT */\r\n                        final int len32 = (int) buffer.getUint32();\r\n                        byte[] binary = new byte[len32];\r\n                        buffer.fillBytes(binary, 0, len32);\r\n                        value = binary;\r\n                        javaType = Types.LONGVARBINARY;\r\n                        length = len32;\r\n                        break;\r\n                    }\r\n                    default:\r\n                        throw new IllegalArgumentException(\"!! Unknown BLOB packlen = \" + meta);\r\n                }\r\n                break;\r\n            }\r\n            case LogEvent.MYSQL_TYPE_VARCHAR:\r\n            case LogEvent.MYSQL_TYPE_VAR_STRING: {\r\n                /*\r\n                 * Except for the data length calculation, MYSQL_TYPE_VARCHAR,\r\n                 * MYSQL_TYPE_VAR_STRING and MYSQL_TYPE_STRING are handled the same way.\r\n                 */\r\n                len = meta;\r\n                if (len < 256) {\r\n                    len = buffer.getUint8();\r\n                } else {\r\n                    len = buffer.getUint16();\r\n                }\r\n\r\n                if (isBinary) {\r\n                    // fixed issue #66 ,binary类型在binlog中为var_string\r","sourceCodeStart":965,"sourceCodeEnd":1001,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsLogBuffer.java#L965-L1001","documentation":"Thrown while decoding a MYSQL_TYPE_BLOB column family. The metadata field (meta, named packlen here) encodes the length-prefix size: 1=TINYBLOB, 2=BLOB, 3=MEDIUMBLOB, 4=LONGBLOB. The switch handles 1-4 only; any other value is invalid because MySQL blob length prefixes are always 1-4 bytes. Hitting the default means the Table_map event carried a corrupt or unrecognized blob metadata word.","triggerScenarios":"A Table_map_event declares a BLOB column with a packlen meta value of 0 or > 4. Caused by corruption or a source that mis-encodes blob metadata.","commonSituations":"Binlog corruption; replicating from a non-MySQL-compatible source; partial binlog read truncating the table-map event so meta is misread.","solutions":["Verify the BLOB/TEXT column type on the master and that Canal's table-map cache matches.","Run mysqlbinlog --hexdump at the failing position to confirm metadata integrity.","Upgrade Canal to the version matching the master.","Filter the table if the blob column is not needed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"boolean isValidBlobPacklen(int meta) {\n    return meta >= 1 && meta <= 4; // TINY/BLOB/MEDIUM/LONG\n}","typeGuard":null,"tryCatchPattern":"try {\n    buffer.fetchValue(name, index, type, meta, isBinary);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"!! Unknown BLOB packlen\")) {\n        logger.warn(\"Corrupt BLOB packlen meta={} in tableId={}, skipping column\", meta, tableId);\n    } else throw e;\n}","preventionTips":["Keep Canal and master MySQL versions aligned.","Validate binlog events with mysqlbinlog --hexdump when blob decode errors recur.","Filter large-blob tables if not needed to reduce exposure."],"tags":["binlog","rows-buffer","column-type","blob","parsing"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}