vitessio/vitess · error
failed to convert server-id: %v
Error message
failed to convert server-id: %v
What it means
ReadMycnf requires a server-id in the parsed config; the string is fetched via lookupWithDefault and parsed with strconv.ParseUint(base 10, 32 bits). If parsing fails (missing handled earlier, so this fires on non-numeric or out-of-range values), this error wraps the cause.
Source
Thrown at go/vt/mysqlctl/mycnf.go:210
}
line = bytes.TrimSpace(line)
parts = bytes.Split(line, []byte("="))
if len(parts) < 2 {
continue
}
lval = normKey(parts[0])
rval = string(bytes.TrimSpace(parts[1]))
mycnf.mycnfMap[lval] = rval
}
serverIDStr, err := mycnf.lookupWithDefault("server-id", "")
if err != nil {
return nil, err
}
serverID, err := strconv.ParseUint(serverIDStr, 10, 32)
if err != nil {
return nil, fmt.Errorf("failed to convert server-id: %v", err)
}
mycnf.ServerID = uint32(serverID)
port, err := mycnf.lookupInt("port")
if err != nil {
return nil, err
}
mycnf.MysqlPort = port
mapping := map[string]*string{
"datadir": &mycnf.DataDir,
"innodb_data_home_dir": &mycnf.InnodbDataHomeDir,
"innodb_log_group_home_dir": &mycnf.InnodbLogGroupHomeDir,
"socket": &mycnf.SocketFile,
"general_log_file": &mycnf.GeneralLogPath,
"log-error": &mycnf.ErrorLogPath,
"slow-query-log-file": &mycnf.SlowLogPath,
"relay-log": &mycnf.RelayLogPath,View on GitHub (pinned to 01a25a7d17)
Solutions
- Set server-id to an integer between 1 and 4294967295 in my.cnf.
- Convert any hex or oversized server-id values to a valid 32-bit decimal.
- Ensure each replica has a unique server-id in that range before re-running.
Example fix
// before server-id = 0b9f3a1c-... (uuid) // after server-id = 623
Defensive patterns
Strategy: validation
Validate before calling
v := getCnfValue("server-id")
id, err := strconv.ParseUint(v, 10, 32)
if err != nil { return fmt.Errorf("server-id %q not a uint32: %w", v, err) }
if id == 0 { return errors.New("server-id must be >= 1") } Try / catch
mycnf, err := mysqlctl.ReadMycnf(path)
if err != nil {
if strings.Contains(err.Error(), "server-id") { /* fix server-id in config */ }
return err
} Prevention
- Assign server-id in 1..4294967295 range, unique per replica
- Never copy MariaDB UUID-style server_id values into vitess-managed my.cnf
- Validate server-id during provisioning, not at mysqld start time
When it happens
Trigger: ReadMycnf encountering a server-id that is non-numeric or exceeds uint32 (max 4294967295), e.g. a UUID-based server_id from MariaDB configs or a negative value.
Common situations: Copying server-id from MySQL 8.0's UUID-derived values; typos like 'server-id = 0x10' (hex not accepted); value larger than 32 bits from automated generators.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- cannot perform backup without my.cnf, please restart vttable
- value for key '%v' not set and no default value set
- failed to convert %s: %v
- invalid key:value pair
- Last_SQL_Error: ${LastSQL_Error}, Last_IO_Error: ${LastIO_Er
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/b9b0e4e28d9b0386.
Report an issue: GitHub.