GoogleContainerTools/skaffold · error

unable to lookup minikube executable. Please add it to PATH

Error message

unable to lookup minikube executable. Please add it to PATH environment variable

What it means

minikubeBinary uses sync.Once to locate the minikube executable via exec.LookPath. If minikube is not on PATH, the cached result is this error, returned whenever a minikube cluster context is needed. The result is memoized, so the error persists for the process lifetime.

Source

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

		return semver.Version{}, err
	}
	minikubeOutput := map[string]string{}
	err = json.Unmarshal(out, &minikubeOutput)
	if v, ok := minikubeOutput["minikubeVersion"]; ok {
		currentVersion, err := version.ParseVersion(v)
		if err != nil {
			return semver.Version{}, err
		}
		return currentVersion, nil
	}
	return semver.Version{}, err
}

func minikubeBinary(ctx context.Context) (string, semver.Version, error) {
	findOnce.Do(func() {
		filename, err := exec.LookPath("minikube")
		if err != nil {
			mk.err = errors.New("unable to lookup minikube executable. Please add it to PATH environment variable")
		}
		if _, err := os.Stat(filename); os.IsNotExist(err) {
			mk.err = fmt.Errorf("unable to find minikube executable. File not found %s", filename)
		}
		mk.path = filename
		if v, err := GetCurrentVersionFunc(ctx); err != nil {
			mk.err = versionErr{err: err}
		} else {
			mk.version = v
		}
	})

	return mk.path, mk.version, mk.err
}

type versionErr struct {
	err error
}

View on GitHub (pinned to a1189de023)

Solutions

  1. Install minikube (e.g. `brew install minikube` or download the binary from the minikube releases)
  2. Add minikube's install directory to PATH: `export PATH=$PATH:/usr/local/bin`
  3. Verify with `which minikube` and `minikube version`
  4. Switch to a non-minikube kube context if minikube is not intended: `kubectl config use-context <other>`

Example fix

// before (CI Dockerfile)
RUN kubectl get pods
// after
RUN curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && \
    install minikube-linux-amd64 /usr/local/bin/minikube
Defensive patterns

Strategy: fallback

Validate before calling

command -v minikube >/dev/null 2>&1 || { echo "minikube not on PATH"; exit 1; }
minikube version

Try / catch

path, ver, err := minikubeBinary(ctx)
if err != nil {
  log.Warnf("minikube unavailable (%v); falling back to current kube context", err)
  return useDefaultContext(ctx)
}

Prevention

When it happens

Trigger: Using a kubeconfig context pointing at a minikube cluster (e.g. `skaffold dev --profile` against minikube) while the `minikube` binary is absent from PATH. Also when minikube exists but was removed/moved after PATH changed.

Common situations: Fresh machines or CI containers with a leftover minikube kubeconfig but no minikube install; PATH not including ~/bin or /usr/local/bin where minikube lives; switching from Docker Desktop to minikube contexts.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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