{"record":{"id":"05ba83d4b8a2daa1","repo":"vitessio/vitess","slug":"startpos-gtidset-is-wrong-type-expected-fileposg","errorCode":null,"errorMessage":"startPos.GTIDSet is wrong type - expected filePosGTID, got: %#v","messagePattern":"startPos\\.GTIDSet is wrong type - expected filePosGTID, got: %#v","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/mysql/flavor_filepos.go","lineNumber":141,"sourceCode":"\treturn UnsupportedCommand\n}\n\nfunc (flv *filePosFlavor) startIOThreadCommand() string {\n\treturn UnsupportedCommand\n}\n\n// sendBinlogDumpCommand is part of the Flavor interface.\nfunc (flv *filePosFlavor) sendBinlogDumpCommand(c *Conn, serverID uint32, binlogFilename string, binlogPos uint32) error {\n\tflv.file = binlogFilename\n\treturn c.WriteComBinlogDump(serverID, binlogFilename, uint64(binlogPos), 0)\n}\n\n// sendBinlogDumpGTIDCommand is part of the Flavor interface.\n// Note: flags is not used for file position based replication as it uses COM_BINLOG_DUMP.\nfunc (flv *filePosFlavor) sendBinlogDumpGTIDCommand(c *Conn, serverID uint32, binlogFilename string, _ uint64, startPos replication.Position, flags uint16) error {\n\trpos, ok := startPos.GTIDSet.(replication.FilePosGTID)\n\tif !ok {\n\t\treturn fmt.Errorf(\"startPos.GTIDSet is wrong type - expected filePosGTID, got: %#v\", startPos.GTIDSet)\n\t}\n\n\tflv.file = rpos.File\n\treturn c.WriteComBinlogDump(serverID, rpos.File, rpos.Pos, 0)\n}\n\n// readBinlogEvent is part of the Flavor interface.\nfunc (flv *filePosFlavor) readBinlogEvent(c *Conn) (BinlogEvent, error) {\n\tif ret := flv.savedEvent; ret != nil {\n\t\tflv.savedEvent = nil\n\t\treturn ret, nil\n\t}\n\n\tfor {\n\t\tresult, err := c.ReadPacket()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/mysql/flavor_filepos.go#L123-L159","documentation":"In go/mysql, the filePos flavor (plain MySQL file/position-based replication) requires the starting replication Position to carry a FilePosGTID as its GTID set, since it maps the position onto COM_BINLOG_DUMP with a binlog file name and offset. sendBinlogDumpGTIDCommand returns this error when the Position holds some other GTIDSet implementation (e.g. a MariaDB or MySQL GTID set), meaning the position's flavor does not match the server's replication flavor.","triggerScenarios":"Starting binlog streaming (e.g. BinlogConnection / mysqlctl replication setup) against a server whose flavor resolves to filePosFlavor while passing a replication.Position built from a different flavor's GTID set (e.g. MariadbGTIDSet or Mysql56GTIDSet).","commonSituations":"Misconfigured replication: the source server is detected as file/position-based (e.g. MySQL without GTID enabled, log_bin with gtid_mode=OFF) but the stored/starting position was created with GTID semantics; switching a cluster between GTID and file-pos replication without regenerating positions; pointing a Vitess stream at a MariaDB server with the wrong flavor guess.","solutions":["Rebuild the starting replication.Position so its GTIDSet is a replication.FilePosGTID matching the source server's binlog file and position.","Verify the target server's flavor/GTID configuration: if GTID replication is intended, enable gtid_mode=ON on MySQL (or use the MariaDB flavor) so the correct flavor is selected.","Check how the position was loaded (tablet's relay log start position, shard replication status) and correct the flavor detection (server version/flavor config) that produced the mismatched GTIDSet."],"exampleFix":"// before\nstartPos := replication.Position{GTIDSet: myGTIDSet} // Mysql56GTIDSet\nerr := conn.SendBinlogDumpCommand(serverID, startPos)\n// after\nif _, ok := startPos.GTIDSet.(replication.FilePosGTID); !ok {\n    return vterrors.Errorf(vtrpcpb.Code_FAILED_PRECONDITION, \"filePos replication requires a FilePosGTID position, got %T\", startPos.GTIDSet)\n}\nerr := conn.SendBinlogDumpCommand(serverID, startPos)","handlingStrategy":"type-guard","validationCode":"func canStreamFilePos(startPos replication.Position) bool {\n    _, ok := startPos.GTIDSet.(replication.FilePosGTID)\n    return ok\n}","typeGuard":"func isFilePosGTID(p replication.Position) bool {\n    _, ok := p.GTIDSet.(replication.FilePosGTID)\n    return ok\n}","tryCatchPattern":"err := conn.SendBinlogDumpCommand(serverID, startPos)\nif err != nil && strings.Contains(err.Error(), \"startPos.GTIDSet is wrong type\") {\n    return vterrors.Errorf(vtrpcpb.Code_FAILED_PRECONDITION, \"source requires file/position replication; rebuild startPos with FilePosGTID\")\n}","preventionTips":["Always construct replication.Position with the GTIDSet flavor matching the target server's flavor.","Verify gtid_mode/flavor configuration on the source before starting binlog streams.","Type-assert startPos.GTIDSet to FilePosGTID before invoking the binlog dump path.","Regenerate stored positions when migrating a cluster between GTID and file/position replication."],"tags":["mysql","replication","gtid","binlog"],"backgroundTag":"gtid-set-type-mismatch","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}