alibaba/canal · error · IllegalArgumentException
!! Unknown BLOB packlen =
Error message
!! Unknown BLOB packlen =
What it means
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.
Source
Thrown at dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsLogBuffer.java:983
byte[] binary = new byte[len24];
buffer.fillBytes(binary, 0, len24);
value = binary;
javaType = Types.LONGVARBINARY;
length = len24;
break;
}
case 4: {
/* LONGBLOB/LONGTEXT */
final int len32 = (int) buffer.getUint32();
byte[] binary = new byte[len32];
buffer.fillBytes(binary, 0, len32);
value = binary;
javaType = Types.LONGVARBINARY;
length = len32;
break;
}
default:
throw new IllegalArgumentException("!! Unknown BLOB packlen = " + meta);
}
break;
}
case LogEvent.MYSQL_TYPE_VARCHAR:
case LogEvent.MYSQL_TYPE_VAR_STRING: {
/*
* Except for the data length calculation, MYSQL_TYPE_VARCHAR,
* MYSQL_TYPE_VAR_STRING and MYSQL_TYPE_STRING are handled the same way.
*/
len = meta;
if (len < 256) {
len = buffer.getUint8();
} else {
len = buffer.getUint16();
}
if (isBinary) {
// fixed issue #66 ,binary类型在binlog中为var_string
View on GitHub (pinned to 87be50e876)
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.
Defensive patterns
Strategy: validation
Validate before calling
boolean isValidBlobPacklen(int meta) {
return meta >= 1 && meta <= 4; // TINY/BLOB/MEDIUM/LONG
} Try / catch
try {
buffer.fetchValue(name, index, type, meta, isBinary);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("!! Unknown BLOB packlen")) {
logger.warn("Corrupt BLOB packlen meta={} in tableId={}, skipping column", meta, tableId);
} else throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Binlog corruption; replicating from a non-MySQL-compatible source; partial binlog read truncating the table-map event so meta is misread.
Related errors
- !! Don't know how to handle column type=%d meta=%d (%04X)
- !! Unknown Bit len =
- !! Unknown ENUM packlen =
- !! Unknown Set len =
- !! Unknown JSON packlen =
AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14).
Data as JSON: /api/errors/0c72c81d185b33ed.
Report an issue: GitHub.