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
- Inspect the %s in the message to see the offending tag value
- Fix the image/tag string to a valid reference (lowercase repo, optional :tag/@digest)
- Ensure any env templating renders non-empty values before the call
- 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
- Ensure image-tag templating produces non-empty values
- Use lowercase repos and valid tag characters
- Strip URL schemes from tag strings
- Validate tags with docker.ParseReference upstream
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
- couldn't parse image tag: %w
- %q running container image %q errored during run with status
- docker deployment not supported alongside cluster deployment
- INIT_DOCKER_NETWORK_CONTAINER_DOES_NOT_EXIST
- executing build: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/5d12ba02d23f143c.
Report an issue: GitHub.