{"record":{"id":"b26d82d500aa4d11","repo":"GoogleContainerTools/skaffold","slug":"getting-minikube-executable-w","errorCode":null,"errorMessage":"getting minikube executable: %w","messagePattern":"getting minikube executable: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/cluster/minikube.go","lineNumber":109,"sourceCode":"\n\tif ok, err := matchServerURL(ctx, cluster.Server); err != nil {\n\t\tlog.Entry(context.TODO()).Tracef(\"failed to match server url: %v\", err)\n\t} else if ok {\n\t\tlog.Entry(context.TODO()).Debugf(\"Minikube cluster detected: server url for context %q matches minikube node ip\", kubeContext)\n\t\treturn true\n\t}\n\tlog.Entry(context.TODO()).Tracef(\"Minikube cluster not detected for context %q\", kubeContext)\n\treturn false\n}\n\nfunc (clientImpl) MinikubeExec(ctx context.Context, arg ...string) (*exec.Cmd, error) {\n\treturn minikubeExec(ctx, arg...)\n}\n\nfunc minikubeExec(ctx context.Context, arg ...string) (*exec.Cmd, error) {\n\tb, v, err := FindMinikubeBinary(ctx)\n\tif err != nil && !errors.As(err, &versionErr{}) {\n\t\treturn nil, fmt.Errorf(\"getting minikube executable: %w\", err)\n\t} else if err == nil && supportsUserFlag(v) {\n\t\targ = append(arg, \"--user=skaffold\")\n\t}\n\treturn exec.Command(b, arg...), nil\n}\n\nfunc supportsUserFlag(ver semver.Version) bool {\n\treturn ver.GE(minikubeVersionWithUserFlag)\n}\n\n// Retrieves minikube version\nfunc getCurrentVersion(ctx context.Context) (semver.Version, error) {\n\tcmd := exec.Command(\"minikube\", \"version\", \"--output=json\")\n\tout, err := util.RunCmdOut(ctx, cmd)\n\tif err != nil {\n\t\treturn semver.Version{}, err\n\t}\n\tminikubeOutput := map[string]string{}","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/cluster/minikube.go#L91-L127","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install minikube and ensure it is on PATH and executable: chmod +x $(which minikube)","Re-download the minikube binary if corrupted","Check that no broken minikube shim/wrapper script shadows the real binary in PATH"],"exampleFix":"// before (not executable)\n-rw-r--r-- minikube\n// after\nchmod +x /usr/local/bin/minikube","handlingStrategy":"validation","validationCode":"function requireMinikube() {\n  const p = require('child_process').execSync('which minikube').toString().trim();\n  const st = require('fs').statSync(p);\n  if (!(st.mode & 0o111)) throw new Error(`minikube at ${p} is not executable`);\n  console.log(execSync('minikube version').toString());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["chmod +x after manually installing minikube","Verify `minikube version` works in the same environment skaffold runs in","Avoid shadowing wrappers named minikube in PATH"],"tags":["minikube","binary","environment"],"backgroundTag":"executable-not-found","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}