alibaba/canal · error · CanalParseException
binlog: + binlogfilename + is not found
Error message
binlog: + binlogfilename + is not found
What it means
Thrown as CanalParseException by LocalBinLogConnection.dump(binlogfilename, binlogPosition, coprocessor) when the requested binlog file does not exist under the configured directory. The dump cannot proceed because there is nothing to open and read.
Source
Thrown at parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/LocalBinLogConnection.java:264
} finally {
if (fetcher != null) {
fetcher.close();
}
}
dump(binlogFilename, binlogFileOffset, func);
}
@Override
public void dump(GTIDSet gtidSet, SinkFunction func) throws IOException {
throw new NotImplementedException();
}
@Override
public void dump(String binlogfilename, Long binlogPosition, MultiStageCoprocessor coprocessor) throws IOException {
File current = new File(directory, binlogfilename);
if (!current.exists()) {
throw new CanalParseException("binlog:" + binlogfilename + " is not found");
}
try (FileLogFetcher fetcher = new FileLogFetcher(bufferSize)) {
LogDecoder decoder = new LogDecoder(LogEvent.UNKNOWN_EVENT, LogEvent.ENUM_END_EVENT);
LogContext context = new LogContext();
fetcher.open(current, binlogPosition);
context.setLogPosition(new LogPosition(binlogfilename, binlogPosition));
while (running) {
boolean needContinue = true;
LogEvent event = null;
while (fetcher.fetch()) {
event = decoder.decode(fetcher, context);
if (event == null) {
continue;
}
checkServerId(event);
if (!coprocessor.publish(event)) {
View on GitHub (pinned to 87be50e876)
Solutions
- List the configured directory and confirm the exact binlog filename exists (case-sensitive).
- Correct the directory path so it points at the folder holding the binlog files.
- If the file was purged, reset the start position to an existing binlog or obtain the missing file.
- Align the requested filename format with the actual files (e.g. include the leading path/zero-padding).
Example fix
# before canal.instance.binlog.path = /data/mysql/logs # persisted position references mysql-bin.000010 which is deleted # after canal.instance.binlog.path = /data/mysql/binlog # correct dir # and reset startPosition to an existing file, e.g. mysql-bin.000007
Defensive patterns
Strategy: validation
Validate before calling
java.io.File f = new java.io.File(directory, binlogfilename);
if (!f.exists()) throw new java.io.FileNotFoundException("binlog not found: " + f); Try / catch
try { conn.dump(binlogfilename, position, coprocessor); }
catch (CanalParseException e) {
if (e.getMessage().contains("is not found")) { binlogfilename = firstAvailableBinlog(directory); conn.dump(binlogfilename, 0L, coprocessor); }
else throw e;
} Prevention
- Point canal.instance.binlog.path at the correct folder.
- List the directory and match filenames exactly (case-sensitive).
- Reset stale positions referencing deleted binlogs.
When it happens
Trigger: new File(directory, binlogfilename).exists() is false in the dump overload that takes a filename + position + MultiStageCoprocessor. The requested binlog file name does not match any file in the LocalBinLogConnection directory.
Common situations: The directory (canal.instance.binlog.path or local dump dir) is wrong, the binlog file was rotated/deleted, the filename has a wrong case/extension (mysql-bin.000001 vs mysql-bin.000001), or the persisted position references a file that is no longer present on disk.
Related errors
- can't find start position for {}
- unexpected rds serverId + serverId + in binlog file !
- unexpected serverId + serverId + in binlog file !
- use gtid and TableMeta TSDB should be config timestamp > 0
- parse failed
AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14).
Data as JSON: /api/errors/c0a8d4a4d42c166c.
Report an issue: GitHub.