vitessio/vitess · error

%s not found in any of %s/{%s}

Error message

%s not found in any of %s/{%s}

What it means

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.

Source

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

	if err != nil {
		log.Error(fmt.Sprintf("execCmd: %v failed: %v", name, err))
		err = fmt.Errorf("%v: %w, output: %v", name, err, output)
	}
	return cmd, output, err
}

// binaryPath does a limited path lookup for a command,
// searching only within sbin and bin in the given root.
func binaryPath(root, binary string) (string, error) {
	noSocketFile()
	subdirs := []string{"sbin", "bin", "libexec", "scripts"}
	for _, subdir := range subdirs {
		binPath := path.Join(root, subdir, binary)
		if _, err := os.Stat(binPath); err == nil {
			return binPath, nil
		}
	}
	return "", fmt.Errorf("%s not found in any of %s/{%s}",
		binary, root, strings.Join(subdirs, ","))
}

// InitConfig will create the default directory structure for the mysqld process,
// generate / configure a my.cnf file.
func (mysqld *Mysqld) InitConfig(cnf *Mycnf) error {
	log.Info("mysqlctl.InitConfig")
	err := mysqld.createDirs(cnf)
	if err != nil {
		log.Error(err.Error())
		return err
	}
	// Set up config files.
	if err = mysqld.initConfig(cnf, cnf.Path); err != nil {
		log.Error(fmt.Sprintf("failed creating %v: %v", cnf.Path, err))
		return err
	}
	return nil

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Set the explicit binary path flag (e.g. --mysqld_binary / --mysqld_safe_binary) to the actual location of the binary.
  2. Install MySQL/MariaDB into the expected root, or point root at the prefix containing bin/ or sbin/ with the binary.
  3. Verify with `ls <root>/{bin,sbin}/<binary>` which of the searched paths is wrong.
  4. Fix packaging/container images so the MySQL binaries ship in the expected layout.

Example fix

// before
mysqlctl -root /nonexistent ...
// after
mysqlctl -root /usr/local/mysql -mysqld_binary /usr/local/mysql/bin/mysqld ...
Defensive patterns

Strategy: validation

Validate before calling

for _, b := range []string{"mysqld", "mysqld_safe"} {
    if _, err := exec.LookPath(b); err != nil {
        for _, sub := range []string{"bin", "sbin"} {
            if _, err := os.Stat(path.Join(root, sub, b)); err == nil {
                break
            }
        }
    }
}

Type guard

func binaryPresent(root string, subdirs []string, binary string) bool {
    for _, d := range subdirs {
        if _, err := os.Stat(path.Join(root, d, binary)); err == nil {
            return true
        }
    }
    return false
}

Try / catch

if err := mysqld.Start(ctx, cnf, mysqldArgs, params); err != nil && strings.Contains(err.Error(), "not found in any of") {
    // fix -mysqld_binary / -root flags, then retry
}

Prevention

When it happens

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

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

Related errors


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