{"record":{"id":"493a70da9435ae2e","repo":"GoogleContainerTools/skaffold","slug":"getting-tag-for-image-s","errorCode":null,"errorMessage":"getting tag for image %s","messagePattern":"getting tag for image (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/diagnose/diagnose.go","lineNumber":59,"sourceCode":"}\n\nfunc CheckArtifacts(ctx context.Context, cfg Config, tags tag.ImageTags, out io.Writer) error {\n\tfor _, p := range cfg.GetPipelines() {\n\t\tfor _, artifact := range p.Build.Artifacts {\n\t\t\toutput.Default.Fprintf(out, \"\\n%s: %s\\n\", typeOfArtifact(artifact), artifact.ImageName)\n\n\t\t\tif artifact.DockerArtifact != nil {\n\t\t\t\tsize, err := sizeOfDockerContext(ctx, artifact, cfg)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"computing the size of the Docker context: %w\", err)\n\t\t\t\t}\n\n\t\t\t\tfmt.Fprintf(out, \" - Size of the context: %vbytes\\n\", size)\n\t\t\t}\n\n\t\t\ttag, ok := tags[artifact.ImageName]\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"getting tag for image %s\", artifact.ImageName)\n\t\t\t}\n\n\t\t\ttimeDeps1, deps, err := timeToListDependencies(ctx, artifact, tag, cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"listing artifact dependencies: %w\", err)\n\t\t\t}\n\t\t\ttimeDeps2, _, err := timeToListDependencies(ctx, artifact, tag, cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"listing artifact dependencies: %w\", err)\n\t\t\t}\n\n\t\t\tfmt.Fprintln(out, \" - Dependencies:\", len(deps), \"files\")\n\t\t\tfmt.Fprintf(out, \" - Time to list dependencies: %v (2nd time: %v)\\n\", timeDeps1, timeDeps2)\n\n\t\t\t// Only check sync map if inferred sync is configured on artifact\n\t\t\tif artifact.Sync != nil && len(artifact.Sync.Infer) > 0 {\n\t\t\t\ttimeSyncMap1, err := timeToConstructSyncMap(ctx, artifact, cfg)\n\t\t\t\tif err != nil {","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/diagnose/diagnose.go#L41-L77","documentation":"CheckArtifacts looks up each artifact's tag in the provided tag.ImageTags map (populated by a prior build/tag step). If the image name is absent from the map, this plain error is returned, since dependency listing needs a tag.","triggerScenarios":"Running `skaffold diagnose` with a tags map that was not populated for every configured artifact — e.g. tags built from a previous build that predates a newly added artifact, or an artifact whose image name changed between build and diagnose.","commonSituations":"Adding a new artifact to skaffold.yaml without rebuilding; diagnose run against stale tags; image name typo so the built tag key doesn't match the configured image name.","solutions":["Run `skaffold build` (or `skaffold run --no-prune`) before diagnose so all artifacts have tags","Verify each artifact's image name in skaffold.yaml matches what was built","Delete stale cache and rebuild so the tags map contains every configured image"],"exampleFix":"// before: diagnose without building the newly added artifact\nskaffold diagnose\n// error: getting tag for image new-service\n// after\nskaffold build && skaffold diagnose","handlingStrategy":"validation","validationCode":"for _, a := range cfg.Artifacts() {\n\tif _, ok := tags[a.ImageName]; !ok {\n\t\treturn fmt.Errorf(\"run skaffold build first; no tag for %s\", a.ImageName)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := CheckArtifacts(ctx, cfg, tags, out); err != nil && strings.HasPrefix(err.Error(), \"getting tag for image\") {\n\tlog.Warnf(\"stale/incomplete tags map: %v\", err)\n}","preventionTips":["Always build before diagnose so every artifact has a tag","Keep image names consistent between build config and skaffold.yaml","Regenerate the tags map after any skaffold.yaml artifact change"],"tags":["skaffold","tagging","diagnose"],"backgroundTag":"missing-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"}