GoogleContainerTools/skaffold · error

unable to parse minikube docker-env keyvalue: %s, line: %s,

Error message

unable to parse minikube docker-env keyvalue: %s, line: %s, output: %s

What it means

getMinikubeDockerEnv parses minikube's docker-env output line-by-line as KEY=VALUE pairs; this error is returned when a non-empty, non-comment line contains no '=' separator. It indicates minikube produced unexpected output — often a warning, deprecation notice, or error banner printed alongside the env exports.

Source

Thrown at pkg/skaffold/docker/client.go:243

		return nil, fmt.Errorf("empty minikube profile")
	}
	cmd, err := cluster.GetClient().MinikubeExec(ctx, "docker-env", "--shell", "none", "-p", minikubeProfile)
	if err != nil {
		return nil, fmt.Errorf("executing minikube command: %w", err)
	}
	out, err := util.RunCmdOut(ctx, cmd)
	if err != nil {
		return nil, fmt.Errorf("getting minikube env: %w", err)
	}

	env := map[string]string{}
	for _, line := range strings.Split(string(out), "\n") {
		if line == "" || strings.HasPrefix(line, "#") {
			continue
		}
		kv := strings.SplitN(line, "=", 2)
		if len(kv) != 2 {
			return nil, fmt.Errorf("unable to parse minikube docker-env keyvalue: %s, line: %s, output: %s", kv, line, string(out))
		}
		if kv[1] == "" {
			continue
		}
		env[kv[0]] = kv[1]
	}

	return env, nil
}

// This was copied from api/server/router/image/image_routes.go, since it's not
// exported. The ImageInspect API now returns a dockerspec.DockerOCIImageConfig,
// whereas before it used to return a container.Config, so we need to convert it
// before using it to call ContainerCreate.
func OCIImageConfigToContainerConfig(img string, cfg *dockerspec.DockerOCIImageConfig) *container.Config {
	exposedPorts := make(network.PortSet, len(cfg.ExposedPorts))
	for k, v := range cfg.ExposedPorts {
		p, err := network.ParsePort(k)

View on GitHub (pinned to a1189de023)

Solutions

  1. Update minikube to the latest version so docker-env emits clean KEY=VALUE output.
  2. Run 'minikube -p <profile> docker-env --shell none' manually and inspect any stray lines/warnings; resolve what prints them.
  3. Check for shell wrappers, aliases, or profile scripts that inject output into the minikube invocation.
  4. Verify the profile is healthy ('minikube -p <profile> status'); warnings about stopped/unhealthy clusters often add extra output.

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

out, err := exec.Command("minikube", "-p", profile, "docker-env", "--shell", "none").Output()
if err == nil {
    for _, line := range strings.Split(string(out), "\n") {
        if line == "" || strings.HasPrefix(line, "#") {
            continue
        }
        if !strings.Contains(line, "=") {
            return fmt.Errorf("unexpected minikube docker-env output line %q; update minikube", line)
        }
    }
}

Type guard

func isParseableEnvOutput(out []byte) bool {
    for _, line := range strings.Split(string(out), "\n") {
        if line == "" || strings.HasPrefix(line, "#") {
            continue
        }
        if len(strings.SplitN(line, "=", 2)) != 2 {
            return false
        }
    }
    return true
}

Try / catch

cli, err := newMinikubeAPIClient(ctx, profile)
if err != nil {
    if strings.Contains(err.Error(), "unable to parse minikube docker-env keyvalue") {
        return fmt.Errorf("minikube docker-env output not parseable — update minikube and check for warnings polluting stdout: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: newMinikubeAPIClient -> getMinikubeDockerEnv where minikube's stdout includes a line without '=' (e.g. kubectlNotFound warnings, driver warnings, or shell-mangled output) that fails strings.SplitN(line, "=", 2) yielding len != 2.

Common situations: Outdated minikube version emitting extra banner text; minikube emitting warnings to stdout instead of stderr; locale/encoding issues corrupting output; a wrapper script around minikube that prints extra text.

Understand the failure class

Related errors


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