{"record":{"id":"75a1e061b6bddcf8","repo":"apache/seatunnel","slug":"could-not-find-existing-binlog-information-while-a","errorCode":null,"errorMessage":"Could not find existing binlog information while attempting schema only recovery snapshot","messagePattern":"Could not find existing binlog information while attempting schema only recovery snapshot","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/legacy/SnapshotReader.java","lineNumber":1015,"sourceCode":"    /** Whether DDL for the given table should be recorded. */\n    private boolean shouldRecordTableSchema(MySqlSchema schema, Filters filters, TableId id) {\n        // some tables are always ignored, also if we're recording the schema of non-captured tables\n        if (filters.ignoredTableFilter().test(id)) {\n            return false;\n        }\n\n        return filters.tableFilter().test(id) || !schema.isStoreOnlyCapturedTablesDdl();\n    }\n\n    protected void readBinlogPosition(\n            int step, SourceInfo source, JdbcConnection mysql, AtomicReference<String> sql)\n            throws SQLException {\n        if (context.isSchemaOnlyRecoverySnapshot()) {\n            // We are in schema only recovery mode, use the existing binlog position\n            if (Strings.isNullOrEmpty(source.binlogFilename())) {\n                // would like to also verify binlog position exists, but it defaults to 0 which is\n                // technically valid\n                throw new IllegalStateException(\n                        \"Could not find existing binlog information while attempting schema only recovery snapshot\");\n            }\n            source.startSnapshot();\n        } else {\n            logger.info(\"Step {}: read binlog position of MySQL primary server\", step);\n            String showMasterStmt = ((MySqlConnection) mysql).binaryLogStatusStatement();\n            sql.set(showMasterStmt);\n            mysql.query(\n                    sql.get(),\n                    rs -> {\n                        if (rs.next()) {\n                            String binlogFilename = rs.getString(1);\n                            long binlogPosition = rs.getLong(2);\n                            source.setBinlogStartPoint(binlogFilename, binlogPosition);\n                            if (rs.getMetaData().getColumnCount() > 4) {\n                                // This column exists only in MySQL 5.6.5 or later ...\n                                String gtidSet =\n                                        rs.getString(","sourceCodeStart":997,"sourceCodeEnd":1033,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/legacy/SnapshotReader.java#L997-L1033","documentation":"In schema-only recovery snapshot mode, SnapshotReader.readBinlogPosition expects the stored offsets to contain a previously recorded binlog filename from an earlier run. If source.binlogFilename() is null or empty, an IllegalStateException is thrown because recovery cannot resume the stream without a known binlog position.","triggerScenarios":"Running with snapshot.mode=schema_only_recovery when offsets are missing, corrupted, or the connector was never run before (no prior binlog position was stored), so binlogFilename() returns empty.","commonSituations":"Starting a fresh connector directly with schema_only_recovery; deleted/lost offset storage (Kafka topic or file dropped); offsets wiped after reconfiguration of offset.topic.name.","solutions":["Run an initial snapshot first (snapshot.mode=initial/when_needed) so a binlog position is persisted in offsets.","Restore the offset storage (Kafka offsets topic / local offsets file) from backup.","Use snapshot.mode=schema_only instead of schema_only_recovery if no prior state should exist.","Verify binlogFilename offset key exists in stored offsets before using recovery mode."],"exampleFix":"// before\n'snapshot.mode': 'schema_only_recovery'  // no prior offsets exist\n// after\n'snapshot.mode': 'initial'  // run once to establish offsets, then switch","handlingStrategy":"validation","validationCode":"// Check offsets contain a binlog filename before recovery mode\nString binlogFile = (String) offsets.get(\"binlog_file\");\nif (binlogFile == null || binlogFile.isEmpty()) {\n    throw new IllegalStateException(\"schema_only_recovery requires existing offsets with binlog_file\");\n}","typeGuard":null,"tryCatchPattern":"try { recover(); } catch (IllegalStateException e) { if (e.getMessage().contains(\"Could not find existing binlog\")) { /* fall back to initial snapshot */ } throw e; }","preventionTips":["Never start a brand-new connector directly in schema_only_recovery mode.","Back up offset storage (Kafka topic / offsets file) before maintenance.","Monitor offsets topic retention so state isn't deleted."],"tags":["snapshot","offsets","state","cdc"],"backgroundTag":"invalid-state-transition","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}