GoogleContainerTools/skaffold · error

empty minikube profile

Error message

empty minikube profile

What it means

getMinikubeDockerEnv returns this when the minikubeProfile argument is an empty string. Skaffold needs a profile name to run 'minikube docker-env -p <profile>'; without one it cannot determine which minikube cluster's Docker daemon to connect to. It is a fast-fail input validation guard before shelling out to minikube.

Source

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

	for k, v := range env {
		environment = append(environment, fmt.Sprintf("%s=%s", k, v))
	}
	sort.Strings(environment)

	return environment, api, err
}

func getUserAgentHeader() map[string]string {
	userAgent := fmt.Sprintf("skaffold-%s", version.Get().Version)
	log.Entry(context.TODO()).Debugf("setting Docker user agent to %s", userAgent)
	return map[string]string{
		"User-Agent": userAgent,
	}
}

func getMinikubeDockerEnv(ctx context.Context, minikubeProfile string) (map[string]string, error) {
	if minikubeProfile == "" {
		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))

View on GitHub (pinned to a1189de023)

Solutions

  1. Pass a valid minikube profile name, e.g. 'skaffold --profile minikube --minikube-profile myprofile' or set the profile field in your config.
  2. Verify the profile exists with 'minikube profile list' and use one of the listed names (default is 'minikube').
  3. If running from a script, ensure the variable holding the profile name is set: 'PROFILE=${PROFILE:-minikube}'.

Example fix

// before
cmd := exec.Command("skaffold", "run", "--minikube-profile", profile)
// after
if profile == "" {
    profile = "minikube"
}
cmd := exec.Command("skaffold", "run", "--minikube-profile", profile)
Defensive patterns

Strategy: validation

Validate before calling

if minikubeProfile == "" {
    return fmt.Errorf("minikube profile must be non-empty; pass --minikube-profile or set it in config")
}

Type guard

func hasMinikubeProfile(cfg *Config) bool {
    return cfg != nil && strings.TrimSpace(cfg.MinikubeProfile) != ""
}

Try / catch

cli, err := newMinikubeAPIClient(ctx, profile)
if err != nil {
    if strings.Contains(err.Error(), "empty minikube profile") {
        return fmt.Errorf("no minikube profile given: set --minikube-profile (e.g. 'minikube')")
    }
    return err
}

Prevention

When it happens

Trigger: Calling newMinikubeAPIClient (directly or via newAPIClient) with an empty minikube profile — e.g. the --minikube-profile flag / MINIKUBE_PROFILE config value is unset or empty string.

Common situations: User forgot to pass --profile or left the minikubeProfile field empty in config; a script passes an unset shell variable as the profile; config file has 'minikubeProfile: ""'.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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