alibaba/canal · critical · CanalParseException
command : 'show binlog events limit 1' has an error! pls che
Error message
command : 'show binlog events limit 1' has an error! pls check. you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation
What it means
Thrown when findStartPosition() queries 'show binlog events limit 1' and the returned ResultSetPacket has no field values. Canal interprets an empty result as evidence that the MySQL account lacks SUPER or REPLICATION CLIENT privileges — MySQL returns an empty result set (rather than an explicit error) when the user is not permitted to read binlog events. The start position (binlog filename + offset) cannot be determined, so parsing cannot proceed.
Source
Thrown at parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java:712
return endPosition;
} catch (IOException e) {
throw new CanalParseException("command : '" + showSql + "' has an error!", e);
}
}
/**
* 查询当前的binlog位置
*/
private EntryPosition findStartPosition(MysqlConnection mysqlConnection) {
try {
String showSql = "show binlog events limit 1";
if (multiStreamEnable) {
showSql = "show binlog events with " + destination + " limit 1";
}
ResultSetPacket packet = mysqlConnection.query(showSql);
List<String> fields = packet.getFieldValues();
if (CollectionUtils.isEmpty(fields)) {
throw new CanalParseException(
"command : 'show binlog events limit 1' has an error! pls check. you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation");
}
EntryPosition endPosition = new EntryPosition(fields.get(0), Long.valueOf(fields.get(1)));
return endPosition;
} catch (IOException e) {
throw new CanalParseException("command : 'show binlog events limit 1' has an error!", e);
}
}
/**
* 查询当前的slave视图的binlog位置
*/
@SuppressWarnings("unused")
private SlaveEntryPosition findSlavePosition(MysqlConnection mysqlConnection) {
try {
String showSql = "show slave status";
if (mysqlConnection.atLeastMySQL84()) {View on GitHub (pinned to 87be50e876)
Solutions
- GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%'; then FLUSH PRIVILEGES on the MySQL server.
- Verify the correct credentials are set in canal instance properties (canal.instance.dbUsername / canal.instance.dbPassword).
- Test the grant by running 'SHOW BINLOG EVENTS LIMIT 1;' directly in the MySQL CLI as the canal user.
- If on MySQL 8.0+, ensure the user uses the caching_sha2_password or mysql_native_password auth plugin that canal's driver supports.
Example fix
-- before CREATE USER 'canal'@'%' IDENTIFIED BY '***'; GRANT SELECT ON mydb.* TO 'canal'@'%'; -- after CREATE USER 'canal'@'%' IDENTIFIED BY '***'; GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%'; FLUSH PRIVILEGES;
Defensive patterns
Strategy: validation
Validate before calling
// Before starting the parser, verify replication privileges
ResultSetPacket rs = mysqlConnection.query("SHOW GRANTS FOR CURRENT_USER()");
List<String> grants = rs.getFieldValues();
boolean hasReplicationPriv = grants.stream()
.anyMatch(g -> g.contains("REPLICATION CLIENT") || g.contains("REPLICATION SLAVE") || g.contains("SUPER"));
if (!hasReplicationPriv) {
throw new IllegalStateException("Canal user lacks REPLICATION SLAVE/CLIENT privilege");
} Try / catch
try {
EntryPosition pos = findStartPosition(mysqlConnection);
} catch (CanalParseException e) {
if (e.getMessage().contains("REPLICATION CLIENT privilege")) {
// alert ops to grant privileges, do not retry until fixed
throw new ConfigurationException("MySQL user needs REPLICATION SLAVE, REPLICATION CLIENT", e);
}
throw e;
} Prevention
- Document the required MySQL grants in your Canal deployment runbook.
- Add a startup health-check that runs SHOW GRANTS and verifies replication privileges before entering the main parse loop.
- Use a dedicated MySQL account for Canal with only REPLICATION SLAVE, REPLICATION CLIENT, and SELECT.
When it happens
Trigger: The MysqlEventParser calls mysqlConnection.query("show binlog events limit 1") during startup position discovery. If packet.getFieldValues() is empty or null, this exception fires. Also triggered when multiStreamEnable uses the "show binlog events with <destination> limit 1" variant and the same empty-result condition holds.
Common situations: The canal.link user was granted only standard DML privileges (SELECT/INSERT/UPDATE/DELETE) without REPLICATION SLAVE or REPLICATION CLIENT. A DBA created the account for application use and forgot replication grants. On MySQL 8.0+ the privilege name changed and the grant was missed. On a read-replica, the replication user on the replica differs from the one on the primary.
Related errors
- Received error packet: errno = {}, sqlstate = {} errmsg = {}
- command : 'show binlog events limit 1' has an error!
- errno = {}, sqlstate = {} errmsg = {}
- No such method: '{}' @ {}
- No such field: '{}' @ {}
AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14).
Data as JSON: /api/errors/ffc649bbfd18ad1a.
Report an issue: GitHub.