vitessio/vitess · error

could not parse server version from: %s

Error message

could not parse server version from: %s

What it means

ParseVersionString extracts major/minor/patch from a mysqld version string (e.g. from `mysqld --version`). The versionRegex failed to match the input, so no X.Y.Z triple could be found. Vitess throws this because flavor-specific behavior depends on knowing the exact server version.

Source

Thrown at go/vt/mysqlctl/mysqld.go:390

		return "", err
	}
	return version, nil
}

// ParseVersionString parses the output of mysqld --version into a flavor and version
func ParseVersionString(version string) (flavor MySQLFlavor, ver ServerVersion, err error) {
	if strings.Contains(version, "Percona") {
		flavor = FlavorPercona
	} else if strings.Contains(version, "MariaDB") {
		flavor = FlavorMariaDB
	} else {
		// OS distributed MySQL releases have a version string like:
		// mysqld  Ver 5.7.27-0ubuntu0.19.04.1 for Linux on x86_64 ((Ubuntu))
		flavor = FlavorMySQL
	}
	v := versionRegex.FindStringSubmatch(version)
	if len(v) != 4 {
		return flavor, ver, fmt.Errorf("could not parse server version from: %s", version)
	}
	ver.Major, err = strconv.Atoi(string(v[1]))
	if err != nil {
		return flavor, ver, fmt.Errorf("could not parse server version from: %s", version)
	}
	ver.Minor, err = strconv.Atoi(string(v[2]))
	if err != nil {
		return flavor, ver, fmt.Errorf("could not parse server version from: %s", version)
	}
	ver.Patch, err = strconv.Atoi(string(v[3]))
	if err != nil {
		return flavor, ver, fmt.Errorf("could not parse server version from: %s", version)
	}

	return
}

// RunMysqlUpgrade will run the mysql_upgrade program on the current

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Run `mysqld --version` manually and confirm the output contains a numeric X.Y.Z version
  2. Ensure the configured mysqld binary path points at the real server binary, not a wrapper script with extra output
  3. Check the versionRegex in go/vt/mysqlctl/mysqld.go and extend it if your fork's version format differs
  4. File an issue / patch vitess to support your flavor's version string

Example fix

// before: unparseable custom banner
mysqld  Ver custom-build for Linux
// after: make the binary report a standard banner
mysqld  Ver 8.0.34-custom for Linux on x86_64
Defensive patterns

Strategy: validation

Validate before calling

out, err := exec.Command(mysqldPath, "--version").Output()
if err != nil || !regexp.MustCompile(`\d+\.\d+\.\d+`).Match(out) {
    return fmt.Errorf("mysqld version output unparseable: %q", out)
}

Type guard

func versionParsable(version string) bool {
    return versionRegex.MatchString(version)
}

Prevention

When it happens

Trigger: Calling Mysqld.ParseVersionString (directly or via Setup/runMysql/getDBTypeVersionInUse) with a version string that does not contain a recognizable `<major>.<minor>.<patch>` sequence, e.g. empty output, a dev/build string, or an unrecognized fork.

Common situations: Using a non-standard MySQL fork or forked binary whose version banner differs (Percona usually parses fine, but custom builds may not); mysqld binary broken/misPATHed so `--version` prints an error; MariaDB version strings with unusual suffixes; running against a mock or stub binary in tests.

Related errors


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