{"record":{"id":"e3ff92fc08309f53","repo":"vitessio/vitess","slug":"s-not-found-in-any-of-s-s","errorCode":null,"errorMessage":"%s not found in any of %s/{%s}","messagePattern":"(.+?) not found in any of (.+?)/(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/mysqld.go","lineNumber":1287,"sourceCode":"\tif err != nil {\n\t\tlog.Error(fmt.Sprintf(\"execCmd: %v failed: %v\", name, err))\n\t\terr = fmt.Errorf(\"%v: %w, output: %v\", name, err, output)\n\t}\n\treturn cmd, output, err\n}\n\n// binaryPath does a limited path lookup for a command,\n// searching only within sbin and bin in the given root.\nfunc binaryPath(root, binary string) (string, error) {\n\tnoSocketFile()\n\tsubdirs := []string{\"sbin\", \"bin\", \"libexec\", \"scripts\"}\n\tfor _, subdir := range subdirs {\n\t\tbinPath := path.Join(root, subdir, binary)\n\t\tif _, err := os.Stat(binPath); err == nil {\n\t\t\treturn binPath, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"%s not found in any of %s/{%s}\",\n\t\tbinary, root, strings.Join(subdirs, \",\"))\n}\n\n// InitConfig will create the default directory structure for the mysqld process,\n// generate / configure a my.cnf file.\nfunc (mysqld *Mysqld) InitConfig(cnf *Mycnf) error {\n\tlog.Info(\"mysqlctl.InitConfig\")\n\terr := mysqld.createDirs(cnf)\n\tif err != nil {\n\t\tlog.Error(err.Error())\n\t\treturn err\n\t}\n\t// Set up config files.\n\tif err = mysqld.initConfig(cnf, cnf.Path); err != nil {\n\t\tlog.Error(fmt.Sprintf(\"failed creating %v: %v\", cnf.Path, err))\n\t\treturn err\n\t}\n\treturn nil","sourceCodeStart":1269,"sourceCodeEnd":1305,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/mysqld.go#L1269-L1305","documentation":"binaryPath looks up a required binary (e.g. mysqld, mysqld_safe) by checking each configured subdirectory (bin, sbin) under a root prefix. If os.Stat finds the binary in none of them, it returns this error listing the binary and the searched roots. It means the Vitess installation prefix does not contain the expected MySQL binaries.","triggerScenarios":"Any code path calling binaryPath(root, subdirs, binary) where the file <root>/{bin,sbin}/<binary> does not exist — typically during mysqld startup/initialization when locating mysqld or mysqld_safe.","commonSituations":"Incorrect -mysqld_binary or root prefix configuration pointing at a directory without the MySQL install; MySQL installed via a different layout (e.g. /usr/bin instead of <root>/bin); partial or failed MySQL installation; using mysqlctl against a container image lacking the binaries.","solutions":["Set the explicit binary path flag (e.g. --mysqld_binary / --mysqld_safe_binary) to the actual location of the binary.","Install MySQL/MariaDB into the expected root, or point root at the prefix containing bin/ or sbin/ with the binary.","Verify with `ls <root>/{bin,sbin}/<binary>` which of the searched paths is wrong.","Fix packaging/container images so the MySQL binaries ship in the expected layout."],"exampleFix":"// before\nmysqlctl -root /nonexistent ...\n// after\nmysqlctl -root /usr/local/mysql -mysqld_binary /usr/local/mysql/bin/mysqld ...","handlingStrategy":"validation","validationCode":"for _, b := range []string{\"mysqld\", \"mysqld_safe\"} {\n    if _, err := exec.LookPath(b); err != nil {\n        for _, sub := range []string{\"bin\", \"sbin\"} {\n            if _, err := os.Stat(path.Join(root, sub, b)); err == nil {\n                break\n            }\n        }\n    }\n}","typeGuard":"func binaryPresent(root string, subdirs []string, binary string) bool {\n    for _, d := range subdirs {\n        if _, err := os.Stat(path.Join(root, d, binary)); err == nil {\n            return true\n        }\n    }\n    return false\n}","tryCatchPattern":"if err := mysqld.Start(ctx, cnf, mysqldArgs, params); err != nil && strings.Contains(err.Error(), \"not found in any of\") {\n    // fix -mysqld_binary / -root flags, then retry\n}","preventionTips":["Set explicit --mysqld_binary / --mysqld_safe_binary flags instead of relying on root-prefix lookup.","Verify MySQL binaries exist in the container image build.","Keep MySQL installed under a prefix with bin/ and sbin/ layouts Vitess expects.","Smoke-test mysqlctl init in CI after packaging changes."],"tags":["mysql","binary-lookup","configuration","mysqlctl","path"],"backgroundTag":"binary-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}