GoogleContainerTools/skaffold · error

getting minikube executable: %w

Error message

getting minikube executable: %w

What it means

minikubeExec locates the minikube binary via FindMinikubeBinary. Any lookup failure other than a version error (versionErr) is wrapped as 'getting minikube executable'. This lets Skaffold detect minikube clusters but requires the binary to be present and runnable.

Source

Thrown at pkg/skaffold/cluster/minikube.go:109

	if ok, err := matchServerURL(ctx, cluster.Server); err != nil {
		log.Entry(context.TODO()).Tracef("failed to match server url: %v", err)
	} else if ok {
		log.Entry(context.TODO()).Debugf("Minikube cluster detected: server url for context %q matches minikube node ip", kubeContext)
		return true
	}
	log.Entry(context.TODO()).Tracef("Minikube cluster not detected for context %q", kubeContext)
	return false
}

func (clientImpl) MinikubeExec(ctx context.Context, arg ...string) (*exec.Cmd, error) {
	return minikubeExec(ctx, arg...)
}

func minikubeExec(ctx context.Context, arg ...string) (*exec.Cmd, error) {
	b, v, err := FindMinikubeBinary(ctx)
	if err != nil && !errors.As(err, &versionErr{}) {
		return nil, fmt.Errorf("getting minikube executable: %w", err)
	} else if err == nil && supportsUserFlag(v) {
		arg = append(arg, "--user=skaffold")
	}
	return exec.Command(b, arg...), nil
}

func supportsUserFlag(ver semver.Version) bool {
	return ver.GE(minikubeVersionWithUserFlag)
}

// Retrieves minikube version
func getCurrentVersion(ctx context.Context) (semver.Version, error) {
	cmd := exec.Command("minikube", "version", "--output=json")
	out, err := util.RunCmdOut(ctx, cmd)
	if err != nil {
		return semver.Version{}, err
	}
	minikubeOutput := map[string]string{}

View on GitHub (pinned to a1189de023)

Solutions

  1. Install minikube and ensure it is on PATH and executable: chmod +x $(which minikube)
  2. Re-download the minikube binary if corrupted
  3. Check that no broken minikube shim/wrapper script shadows the real binary in PATH

Example fix

// before (not executable)
-rw-r--r-- minikube
// after
chmod +x /usr/local/bin/minikube
Defensive patterns

Strategy: validation

Validate before calling

function requireMinikube() {
  const p = require('child_process').execSync('which minikube').toString().trim();
  const st = require('fs').statSync(p);
  if (!(st.mode & 0o111)) throw new Error(`minikube at ${p} is not executable`);
  console.log(execSync('minikube version').toString());
}

Prevention

When it happens

Trigger: FindMinikubeBinary returns a non-version error — e.g. the binary exists but cannot be executed, lookup fails with an unexpected OS error, or the context required for lookup is cancelled. Version-check failures (versionErr) are deliberately allowed through.

Common situations: minikube installed in a directory without execute permission; corrupted download of minikube; running in a restricted environment where exec.LookPath fails oddly; PATH containing a non-executable file named minikube.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/b26d82d500aa4d11. Report an issue: GitHub.