{"record":{"id":"4bb585febefa321e","repo":"GoogleContainerTools/skaffold","slug":"getting-image-w","errorCode":null,"errorMessage":"getting image: %w","messagePattern":"getting image: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/remote.go","lineNumber":65,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(platforms) > 1 {\n\t\tindex, err := getRemoteIndex(src, cfg)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"getting image index: %w\", err)\n\t\t}\n\t\treturn remote.WriteIndex(targetRef, index, remote.WithAuthFromKeychain(primaryKeychain))\n\t}\n\n\tvar pl v1.Platform\n\tif len(platforms) == 1 {\n\t\tpl = util.ConvertToV1Platform(platforms[0])\n\t}\n\timg, err := getRemoteImage(src, cfg, pl)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting image: %w\", err)\n\t}\n\n\treturn remote.Write(targetRef, img, remote.WithAuthFromKeychain(primaryKeychain))\n}\n\nfunc getRemoteDigest(identifier string, cfg Config, platforms []specs.Platform) (string, error) {\n\tidx, err := getRemoteIndex(identifier, cfg)\n\tif err == nil {\n\t\treturn digest(idx)\n\t}\n\tif len(platforms) > 1 {\n\t\treturn \"\", fmt.Errorf(\"cannot fetch remote index for multiple platform image %q: %w\", identifier, err)\n\t}\n\tvar pl v1.Platform\n\tif len(platforms) == 1 {\n\t\tpl = util.ConvertToV1Platform(platforms[0])\n\t}\n\timg, err := getRemoteImage(identifier, cfg, pl)","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/remote.go#L47-L83","documentation":"AddRemoteTag fails with \"getting image: %w\" when getRemoteImage cannot pull the source image from the remote registry. getRemoteImage parses the reference, applies auth from the default keychain, optionally selects a platform, and calls go-containerregistry's remote.Image. Any registry connectivity, auth, or missing-image failure surfaces wrapped here.","triggerScenarios":"AddRemoteTag called with 0 or 1 platforms while the source image reference is wrong, the image does not exist in the registry, credentials are missing/expired, or the registry is unreachable (only the multi-platform path uses getRemoteIndex instead).","commonSituations":"Typo'd image name or tag passed as src; image was garbage-collected from the registry; docker/config.json has stale push tokens for a private registry; private registry not listed in insecure_registries so TLS fails.","solutions":["Verify the src image exists: run `docker manifest inspect <src>` or `crane digest <src>` with the same tag/digest.","Refresh registry credentials (docker login <registry>) and ensure the credential helper/keychain Skaffold uses has access.","If the registry is HTTP-only or self-signed, add it to insecure_registries in Skaffold config so parseReference/insecureTransportOption apply.","Check network/proxy connectivity to the registry host (DNS, firewall, corporate proxy).","If a specific platform was requested, confirm the image publishes a manifest for that os/arch."],"exampleFix":"// before\ndocker.AddRemoteTag(\"gcr.io/proj/app:v1.0.0\", target, cfg, nil)\n// after — verify reference and auth first\nif _, err := crane.Digest(\"gcr.io/proj/app:v1.0.0\"); err != nil { log.Fatalf(\"source image not reachable: %v\", err) }\ndocker.AddRemoteTag(\"gcr.io/proj/app:v1.0.0\", target, cfg, nil)","handlingStrategy":"validation","validationCode":"func imageReachable(ref string) error {\n\t_, err := crane.Digest(ref)\n\treturn err\n}\n// call before AddRemoteTag: if err := imageReachable(src); err != nil { return fmt.Errorf(\"source image not reachable: %w\", err) }","typeGuard":"func isValidImageRef(s string) bool {\n\t_, err := name.ParseReference(s, name.WeakValidation)\n\treturn err == nil && s != \"\"\n}","tryCatchPattern":"if err := docker.AddRemoteTag(src, target, cfg, platforms); err != nil {\n\tif strings.Contains(err.Error(), \"getting image\") {\n\t\tvar te *transport.Error\n\t\tif errors.As(err, &te) && te.StatusCode == http.StatusNotFound {\n\t\t\treturn fmt.Errorf(\"image %s not found in registry; check tag/digest\", src)\n\t\t}\n\t}\n\treturn err\n}","preventionTips":["Validate the source reference parses and resolves (crane digest) before AddRemoteTag.","Keep docker credentials fresh; script docker login before CI jobs.","Add insecure registries to insecure_registries proactively.","Pin images by digest to avoid tag mutation/garbage collection surprises."],"tags":["docker","registry","network","go-containerregistry"],"backgroundTag":"remote-image-fetch-failed","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"}