{"record":{"id":"08f63b58cea99fdb","repo":"GoogleContainerTools/skaffold","slug":"parsing-tag-q-w","errorCode":null,"errorMessage":"parsing tag %q: %w","messagePattern":"parsing tag %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/remote.go","lineNumber":105,"sourceCode":"\n\treturn digest(img)\n}\n\n// RetrieveRemoteConfig retrieves the remote config file for an image\nfunc RetrieveRemoteConfig(identifier string, cfg Config, platform v1.Platform) (*v1.ConfigFile, error) {\n\timg, err := getRemoteImage(identifier, cfg, platform)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn img.ConfigFile()\n}\n\n// Push pushes the tarball image\nfunc Push(tarPath, tag string, cfg Config, platforms []specs.Platform) (string, error) {\n\tt, err := name.NewTag(tag, name.WeakValidation)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"parsing tag %q: %w\", tag, err)\n\t}\n\n\ti, err := tarball.ImageFromPath(tarPath, nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"reading image %q: %w\", tarPath, err)\n\t}\n\n\tif err := remote.Write(t, i, remote.WithAuthFromKeychain(primaryKeychain)); err != nil {\n\t\treturn \"\", fmt.Errorf(\"%s %q: %w\", sErrors.PushImageErr, t, err)\n\t}\n\n\treturn getRemoteDigest(tag, cfg, platforms)\n}\n\nfunc getRemoteImage(identifier string, cfg Config, platform v1.Platform) (v1.Image, error) {\n\tref, err := parseReference(identifier, cfg)\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/remote.go#L87-L123","documentation":"Push validates the tag string with go-containerregistry's name.NewTag (WeakValidation) before pushing, and returns \"parsing tag %q\" when the string is not a valid image tag. A tag must include a repository path and conform to registry naming rules (lowercase, allowed separators, valid tag suffix).","triggerScenarios":"Push called with a tag missing the repository part (e.g. \"myimage\" without registry/namespace is still fine, but empty or containing uppercase, spaces, invalid characters like :tag:extra, or just \":latest\").","commonSituations":"Empty tag because an upstream templating variable didn't render; uppercase image names (e.g. \"MyApp\") which registries reject; full image URLs with scheme prefix (\"https://...\") or digest references passed where a tag is required.","solutions":["Inspect the logged tag value — it is printed with %q, making empty strings and stray whitespace visible.","Normalize the image name to lowercase and strip any scheme (docker://, https://).","Ensure the string is a tag, not a digest reference (use @sha256:... only where references are accepted).","Trim trailing slashes/colons; a tag like \"repo/img:\" or \"repo/img:v1@digest\" is invalid for NewTag.","Test the exact string with `name.NewTag(tag, name.WeakValidation)` in a snippet or with `crane tag` to validate."],"exampleFix":"// before\nimage := \"https://gcr.io/Project/App:V1\"\ndocker.Push(tarPath, image, cfg, nil)\n// after\nimage := strings.ToLower(strings.TrimPrefix(\"https://gcr.io/Project/App:V1\", \"https://\"))\ndocker.Push(tarPath, image, cfg, nil)","handlingStrategy":"validation","validationCode":"var tagRe = regexp.MustCompile(`^(?:[a-z0-9]+(?:[._-][a-z0-9]+)*(?::[0-9]+)?/)?[a-z0-9]+(?:[._-][a-z0-9]+)*(?:/[a-z0-9]+(?:[._-][a-z0-9]+)*)*:[\\w][\\w.-]{0,127}$`)\nfunc validateTag(tag string) error {\n\tif !tagRe.MatchString(tag) {\n\t\treturn fmt.Errorf(\"invalid image tag: %q\", tag)\n\t}\n\t_, err := name.NewTag(tag, name.WeakValidation)\n\treturn err\n}","typeGuard":"func isValidTag(s string) bool {\n\t_, err := name.NewTag(s, name.WeakValidation)\n\treturn err == nil\n}","tryCatchPattern":"if err := validateTag(tag); err != nil { return err }\nif _, err := docker.Push(tarPath, tag, cfg, platforms); err != nil {\n\tif strings.Contains(err.Error(), \"parsing tag\") {\n\t\treturn fmt.Errorf(\"check image name: must be lowercase, no scheme, valid tag: %v\", err)\n\t}\n\treturn err\n}","preventionTips":["Lowercase image names before pushing; registries reject uppercase.","Strip scheme prefixes (https://, docker://) from references.","Check upstream templating variables actually rendered (no empty tags).","Pre-validate with name.NewTag or crane before invoking Push."],"tags":["docker","validation","image-tag","naming"],"backgroundTag":"invalid-image-tag","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}