{"record":{"id":"aab515ae79cd48cf","repo":"vitessio/vitess","slug":"could-not-parse-server-version-from-s","errorCode":null,"errorMessage":"could not parse server version from: %s","messagePattern":"could not parse server version from: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/mysqld.go","lineNumber":390,"sourceCode":"\t\treturn \"\", err\n\t}\n\treturn version, nil\n}\n\n// ParseVersionString parses the output of mysqld --version into a flavor and version\nfunc ParseVersionString(version string) (flavor MySQLFlavor, ver ServerVersion, err error) {\n\tif strings.Contains(version, \"Percona\") {\n\t\tflavor = FlavorPercona\n\t} else if strings.Contains(version, \"MariaDB\") {\n\t\tflavor = FlavorMariaDB\n\t} else {\n\t\t// OS distributed MySQL releases have a version string like:\n\t\t// mysqld  Ver 5.7.27-0ubuntu0.19.04.1 for Linux on x86_64 ((Ubuntu))\n\t\tflavor = FlavorMySQL\n\t}\n\tv := versionRegex.FindStringSubmatch(version)\n\tif len(v) != 4 {\n\t\treturn flavor, ver, fmt.Errorf(\"could not parse server version from: %s\", version)\n\t}\n\tver.Major, err = strconv.Atoi(string(v[1]))\n\tif err != nil {\n\t\treturn flavor, ver, fmt.Errorf(\"could not parse server version from: %s\", version)\n\t}\n\tver.Minor, err = strconv.Atoi(string(v[2]))\n\tif err != nil {\n\t\treturn flavor, ver, fmt.Errorf(\"could not parse server version from: %s\", version)\n\t}\n\tver.Patch, err = strconv.Atoi(string(v[3]))\n\tif err != nil {\n\t\treturn flavor, ver, fmt.Errorf(\"could not parse server version from: %s\", version)\n\t}\n\n\treturn\n}\n\n// RunMysqlUpgrade will run the mysql_upgrade program on the current","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/mysqld.go#L372-L408","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `mysqld --version` manually and confirm the output contains a numeric X.Y.Z version","Ensure the configured mysqld binary path points at the real server binary, not a wrapper script with extra output","Check the versionRegex in go/vt/mysqlctl/mysqld.go and extend it if your fork's version format differs","File an issue / patch vitess to support your flavor's version string"],"exampleFix":"// before: unparseable custom banner\nmysqld  Ver custom-build for Linux\n// after: make the binary report a standard banner\nmysqld  Ver 8.0.34-custom for Linux on x86_64","handlingStrategy":"validation","validationCode":"out, err := exec.Command(mysqldPath, \"--version\").Output()\nif err != nil || !regexp.MustCompile(`\\d+\\.\\d+\\.\\d+`).Match(out) {\n    return fmt.Errorf(\"mysqld version output unparseable: %q\", out)\n}","typeGuard":"func versionParsable(version string) bool {\n    return versionRegex.MatchString(version)\n}","tryCatchPattern":null,"preventionTips":["Sanity-check `mysqld --version` output during provisioning before pointing vitess at the binary","Pin to official MySQL/Percona/MariaDB builds","Avoid wrapper scripts that add extra output to --version"],"tags":["mysql","version-parsing","mysqlctl"],"backgroundTag":"server-version-parse-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}