{"record":{"id":"848559e47c5ac684","repo":"GoogleContainerTools/skaffold","slug":"getting-minikube-env-w","errorCode":null,"errorMessage":"getting minikube env: %w","messagePattern":"getting minikube env: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/client.go","lineNumber":233,"sourceCode":"func getUserAgentHeader() map[string]string {\n\tuserAgent := fmt.Sprintf(\"skaffold-%s\", version.Get().Version)\n\tlog.Entry(context.TODO()).Debugf(\"setting Docker user agent to %s\", userAgent)\n\treturn map[string]string{\n\t\t\"User-Agent\": userAgent,\n\t}\n}\n\nfunc getMinikubeDockerEnv(ctx context.Context, minikubeProfile string) (map[string]string, error) {\n\tif minikubeProfile == \"\" {\n\t\treturn nil, fmt.Errorf(\"empty minikube profile\")\n\t}\n\tcmd, err := cluster.GetClient().MinikubeExec(ctx, \"docker-env\", \"--shell\", \"none\", \"-p\", minikubeProfile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"executing minikube command: %w\", err)\n\t}\n\tout, err := util.RunCmdOut(ctx, cmd)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting minikube env: %w\", err)\n\t}\n\n\tenv := map[string]string{}\n\tfor _, line := range strings.Split(string(out), \"\\n\") {\n\t\tif line == \"\" || strings.HasPrefix(line, \"#\") {\n\t\t\tcontinue\n\t\t}\n\t\tkv := strings.SplitN(line, \"=\", 2)\n\t\tif len(kv) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse minikube docker-env keyvalue: %s, line: %s, output: %s\", kv, line, string(out))\n\t\t}\n\t\tif kv[1] == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tenv[kv[0]] = kv[1]\n\t}\n\n\treturn env, nil","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/client.go#L215-L251","documentation":"This error wraps a non-zero exit (or execution failure) of the 'minikube docker-env' command itself, reported by util.RunCmdOut. Minikube ran but could not print the Docker environment variables for the given profile — usually because the profile does not exist or the cluster is not running.","triggerScenarios":"newMinikubeAPIClient -> getMinikubeDockerEnv where 'minikube docker-env --shell none -p <profile>' exits non-zero, e.g. profile not found ('profile \"x\" not found'), cluster stopped, or minikube needs 'minikube start' first.","commonSituations":"Typo in the minikube profile name; cluster was deleted or never started; minikube's state directory is corrupted; running minikube docker-env against a profile backed by a driver that is unavailable (e.g. VM driver on a VM-less host).","solutions":["Run 'minikube profile list' to confirm the profile name matches exactly what you passed.","Start the cluster before building: 'minikube -p <profile> start', then retry.","Inspect the wrapped error message for minikube's own output (e.g. 'not found') and act on it.","If the profile is broken, 'minikube -p <profile> delete' and recreate it."],"exampleFix":"// before (cluster never started)\nskaffold run --profile minikube\n// after\nminikube -p minikube start\nskaffold run --profile minikube","handlingStrategy":"retry","validationCode":"out, err := exec.Command(\"minikube\", \"profile\", \"list\").Output()\nif err != nil || !strings.Contains(string(out), minikubeProfile) {\n    // start the profile before proceeding\n    exec.Command(\"minikube\", \"-p\", minikubeProfile, \"start\").Run()\n}","typeGuard":null,"tryCatchPattern":"cli, err := newMinikubeAPIClient(ctx, profile)\nif err != nil {\n    if strings.Contains(err.Error(), \"getting minikube env\") {\n        // ensure the cluster is running, then retry once\n        if err := exec.Command(\"minikube\", \"-p\", profile, \"start\").Run(); err == nil {\n            cli, err = newMinikubeAPIClient(ctx, profile)\n        }\n    }\n    if err != nil {\n        return err\n    }\n}","preventionTips":["Always run 'minikube -p <profile> start' before builds against that profile.","Match profile names exactly against 'minikube profile list'.","Recreate corrupted profiles with 'minikube -p <profile> delete && minikube -p <profile> start'.","Verify the container/VM driver works on your host."],"tags":["minikube","docker","cluster"],"backgroundTag":"minikube-profile-not-running","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"}