vitessio/vitess · error

startPos.GTIDSet is wrong type - expected filePosGTID, got:

Error message

startPos.GTIDSet is wrong type - expected filePosGTID, got: %#v

What it means

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.

Source

Thrown at go/mysql/flavor_filepos.go:141

	return UnsupportedCommand
}

func (flv *filePosFlavor) startIOThreadCommand() string {
	return UnsupportedCommand
}

// sendBinlogDumpCommand is part of the Flavor interface.
func (flv *filePosFlavor) sendBinlogDumpCommand(c *Conn, serverID uint32, binlogFilename string, binlogPos uint32) error {
	flv.file = binlogFilename
	return c.WriteComBinlogDump(serverID, binlogFilename, uint64(binlogPos), 0)
}

// sendBinlogDumpGTIDCommand is part of the Flavor interface.
// Note: flags is not used for file position based replication as it uses COM_BINLOG_DUMP.
func (flv *filePosFlavor) sendBinlogDumpGTIDCommand(c *Conn, serverID uint32, binlogFilename string, _ uint64, startPos replication.Position, flags uint16) error {
	rpos, ok := startPos.GTIDSet.(replication.FilePosGTID)
	if !ok {
		return fmt.Errorf("startPos.GTIDSet is wrong type - expected filePosGTID, got: %#v", startPos.GTIDSet)
	}

	flv.file = rpos.File
	return c.WriteComBinlogDump(serverID, rpos.File, rpos.Pos, 0)
}

// readBinlogEvent is part of the Flavor interface.
func (flv *filePosFlavor) readBinlogEvent(c *Conn) (BinlogEvent, error) {
	if ret := flv.savedEvent; ret != nil {
		flv.savedEvent = nil
		return ret, nil
	}

	for {
		result, err := c.ReadPacket()
		if err != nil {
			return nil, err
		}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Rebuild the starting replication.Position so its GTIDSet is a replication.FilePosGTID matching the source server's binlog file and position.
  2. 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.
  3. 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.

Example fix

// before
startPos := replication.Position{GTIDSet: myGTIDSet} // Mysql56GTIDSet
err := conn.SendBinlogDumpCommand(serverID, startPos)
// after
if _, ok := startPos.GTIDSet.(replication.FilePosGTID); !ok {
    return vterrors.Errorf(vtrpcpb.Code_FAILED_PRECONDITION, "filePos replication requires a FilePosGTID position, got %T", startPos.GTIDSet)
}
err := conn.SendBinlogDumpCommand(serverID, startPos)
Defensive patterns

Strategy: type-guard

Validate before calling

func canStreamFilePos(startPos replication.Position) bool {
    _, ok := startPos.GTIDSet.(replication.FilePosGTID)
    return ok
}

Type guard

func isFilePosGTID(p replication.Position) bool {
    _, ok := p.GTIDSet.(replication.FilePosGTID)
    return ok
}

Try / catch

err := conn.SendBinlogDumpCommand(serverID, startPos)
if err != nil && strings.Contains(err.Error(), "startPos.GTIDSet is wrong type") {
    return vterrors.Errorf(vtrpcpb.Code_FAILED_PRECONDITION, "source requires file/position replication; rebuild startPos with FilePosGTID")
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/05ba83d4b8a2daa1. Report an issue: GitHub.