GoogleContainerTools/skaffold · error

couldn't parse image tag %s %w

Error message

couldn't parse image tag %s %w

What it means

EnvTags derives IMAGE_REPO/IMAGE_NAME/IMAGE_TAG build args from an image tag; it wraps ParseReference failure with the offending tag in the message. The tag string supplied by Build/sourceDependenciesForArtifact was not a parsable image reference.

Source

Thrown at pkg/skaffold/docker/build_args.go:122

	for _, d := range deps {
		t, found := r.GetImageTag(d.ImageName)
		switch {
		case found:
			m[d.Alias] = &t
		case missingIsFatal:
			log.Entry(context.TODO()).Fatalf("failed to resolve build result for required artifact %q", d.ImageName)
		default:
			m[d.Alias] = nil
		}
	}
	return m
}

// EnvTags generate a set of build tags from the docker image name.
func EnvTags(tag string) (map[string]string, error) {
	imgRef, err := ParseReference(tag)
	if err != nil {
		return nil, fmt.Errorf("couldn't parse image tag %s %w", tag, err)
	}
	if imgRef.Tag == "" {
		imgRef.Tag = "latest"
	}
	return map[string]string{
		"IMAGE_REPO": imgRef.Repo,
		"IMAGE_NAME": imgRef.Name,
		"IMAGE_TAG":  imgRef.Tag,
	}, nil
}

View on GitHub (pinned to a1189de023)

Solutions

  1. Inspect the %s in the message to see the offending tag value
  2. Fix the image/tag string to a valid reference (lowercase repo, optional :tag/@digest)
  3. Ensure any env templating renders non-empty values before the call
  4. Remove URL schemes from the tag value

Example fix

// before
tag: "https://gcr.io/proj/img"
// after
tag: "gcr.io/proj/img:v1"
Defensive patterns

Strategy: validation

Validate before calling

if tag == "" {
  return fmt.Errorf("image tag is empty; check templating")
}
if strings.Contains(tag, "://") {
  return fmt.Errorf("tag %q must not contain a scheme", tag)
}
if _, err := docker.ParseReference(tag); err != nil {
  return fmt.Errorf("invalid tag %q: %w", tag, err)
}

Try / catch

tags, err := docker.EnvTags(tag)
if err != nil {
  return fmt.Errorf("IMAGE_REPO/IMAGE_TAG args unavailable; fix tag %q: %w", tag, err)
}

Prevention

When it happens

Trigger: EnvTags(tag) called with a tag that ParseReference rejects — empty string after templating, invalid characters, scheme-prefixed value, or malformed registry/repo:tag.

Common situations: Templated tag (e.g. {{.IMAGE}}) rendering empty; invalid characters from shell interpolation; scheme (https://) accidentally included; typo in registry host.

Related errors


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