GoogleContainerTools/skaffold · error

cannot add an empty image value

Error message

cannot add an empty image value

What it means

The --images / image flag parser converts each `image[=tag]` value into an artifact via convertImageToArtifact. It rejects empty strings outright, then parses anything after '=' as a docker reference. An empty image value (empty string or a lone '=' with empty parts handling) fails immediately with this error.

Source

Thrown at cmd/skaffold/app/flags/image.go:123

	for _, image := range i.images {
		artifacts = append(artifacts, *image.artifact)
	}

	return artifacts
}

// NewEmptyImages returns a new nil Images list.
func NewEmptyImages(usage string) *Images {
	return &Images{
		images: []image{},
		usage:  usage,
	}
}

func convertImageToArtifact(value string) (*graph.Artifact, error) {
	if value == "" {
		return nil, errors.New("cannot add an empty image value")
	}
	if c := strings.SplitN(value, "=", 2); len(c) == 2 {
		_, err := docker.ParseReference(c[1])
		if err != nil {
			return nil, err
		}
		return &graph.Artifact{
			ImageName: c[0],
			Tag:       c[1],
		}, nil
	}
	parsed, err := docker.ParseReference(value)
	if err != nil {
		return nil, err
	}
	return &graph.Artifact{
		ImageName: parsed.BaseName,
		Tag:       value,

View on GitHub (pinned to a1189de023)

Solutions

  1. Provide a valid image name: `--images my-image:tag`
  2. Guard shell variables: `skaffold run --images "${IMAGES:?image required}"`
  3. Strip empty entries before joining lists: filter empty strings out of the comma-separated value

Example fix

// before
skaffold run --images "$IMAGES"
// after
skaffold run --images "${IMAGES:?IMAGES must be set to an image name}"
Defensive patterns

Strategy: validation

Validate before calling

images=$(echo "$IMAGES" | tr ',' '\n' | sed '/^$/d' | paste -sd, -)
[ -n "$images" ] || { echo "no images provided"; exit 1; }
skaffold run --images="$images"

Type guard

function isValidImageValue(v) { return typeof v === 'string' && v.trim().length > 0; }

Try / catch

try {
  skaffold run(['--images=' + img]);
} catch (e) {
  if (String(e).includes('cannot add an empty image value')) {
    console.error('Provide a non-empty image name, e.g. --images my-image:tag');
  }
}

Prevention

When it happens

Trigger: Passing `--images=` (empty value), an empty element from a repeated flag or env-injected variable, or calling flag.AppendValue/Replace APIs with "" programmatically (e.g. from `skaffold run --images "$IMAGES"` with IMAGES unset).

Common situations: CI env var interpolation yielding an empty string; scripts building a comma list where a trailing/leading element is empty; IDE run configurations with a blank images field.

Related errors


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