{"record":{"id":"c0a8d4a4d42c166c","repo":"alibaba/canal","slug":"binlog-binlogfilename-is-not-found","errorCode":null,"errorMessage":"binlog: + binlogfilename +  is not found","messagePattern":"binlog: \\+ binlogfilename \\+  is not found","errorType":"exception","errorClass":"CanalParseException","httpStatus":null,"severity":"error","filePath":"parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/LocalBinLogConnection.java","lineNumber":264,"sourceCode":"        } finally {\r\n            if (fetcher != null) {\r\n                fetcher.close();\r\n            }\r\n        }\r\n\r\n        dump(binlogFilename, binlogFileOffset, func);\r\n    }\r\n\r\n    @Override\r\n    public void dump(GTIDSet gtidSet, SinkFunction func) throws IOException {\r\n        throw new NotImplementedException();\r\n    }\r\n\r\n    @Override\r\n    public void dump(String binlogfilename, Long binlogPosition, MultiStageCoprocessor coprocessor) throws IOException {\r\n        File current = new File(directory, binlogfilename);\r\n        if (!current.exists()) {\r\n            throw new CanalParseException(\"binlog:\" + binlogfilename + \" is not found\");\r\n        }\r\n\r\n        try (FileLogFetcher fetcher = new FileLogFetcher(bufferSize)) {\r\n            LogDecoder decoder = new LogDecoder(LogEvent.UNKNOWN_EVENT, LogEvent.ENUM_END_EVENT);\r\n            LogContext context = new LogContext();\r\n            fetcher.open(current, binlogPosition);\r\n            context.setLogPosition(new LogPosition(binlogfilename, binlogPosition));\r\n            while (running) {\r\n                boolean needContinue = true;\r\n                LogEvent event = null;\r\n                while (fetcher.fetch()) {\r\n                    event = decoder.decode(fetcher, context);\r\n                    if (event == null) {\r\n                        continue;\r\n                    }\r\n                    checkServerId(event);\r\n\r\n                    if (!coprocessor.publish(event)) {\r","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/LocalBinLogConnection.java#L246-L282","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"# before\ncanal.instance.binlog.path = /data/mysql/logs\n# persisted position references mysql-bin.000010 which is deleted\n\n# after\ncanal.instance.binlog.path = /data/mysql/binlog   # correct dir\n# and reset startPosition to an existing file, e.g. mysql-bin.000007","handlingStrategy":"validation","validationCode":"java.io.File f = new java.io.File(directory, binlogfilename);\nif (!f.exists()) throw new java.io.FileNotFoundException(\"binlog not found: \" + f);","typeGuard":null,"tryCatchPattern":"try { conn.dump(binlogfilename, position, coprocessor); }\ncatch (CanalParseException e) {\n    if (e.getMessage().contains(\"is not found\")) { binlogfilename = firstAvailableBinlog(directory); conn.dump(binlogfilename, 0L, coprocessor); }\n    else throw e;\n}","preventionTips":["Point canal.instance.binlog.path at the correct folder.","List the directory and match filenames exactly (case-sensitive).","Reset stale positions referencing deleted binlogs."],"tags":["parse","binlog","local-binlog","filesystem","position"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}