GoogleContainerTools/skaffold · error

getting tag for image %s

Error message

getting tag for image %s

What it means

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.

Source

Thrown at pkg/skaffold/diagnose/diagnose.go:59

}

func CheckArtifacts(ctx context.Context, cfg Config, tags tag.ImageTags, out io.Writer) error {
	for _, p := range cfg.GetPipelines() {
		for _, artifact := range p.Build.Artifacts {
			output.Default.Fprintf(out, "\n%s: %s\n", typeOfArtifact(artifact), artifact.ImageName)

			if artifact.DockerArtifact != nil {
				size, err := sizeOfDockerContext(ctx, artifact, cfg)
				if err != nil {
					return fmt.Errorf("computing the size of the Docker context: %w", err)
				}

				fmt.Fprintf(out, " - Size of the context: %vbytes\n", size)
			}

			tag, ok := tags[artifact.ImageName]
			if !ok {
				return fmt.Errorf("getting tag for image %s", artifact.ImageName)
			}

			timeDeps1, deps, err := timeToListDependencies(ctx, artifact, tag, cfg)
			if err != nil {
				return fmt.Errorf("listing artifact dependencies: %w", err)
			}
			timeDeps2, _, err := timeToListDependencies(ctx, artifact, tag, cfg)
			if err != nil {
				return fmt.Errorf("listing artifact dependencies: %w", err)
			}

			fmt.Fprintln(out, " - Dependencies:", len(deps), "files")
			fmt.Fprintf(out, " - Time to list dependencies: %v (2nd time: %v)\n", timeDeps1, timeDeps2)

			// Only check sync map if inferred sync is configured on artifact
			if artifact.Sync != nil && len(artifact.Sync.Infer) > 0 {
				timeSyncMap1, err := timeToConstructSyncMap(ctx, artifact, cfg)
				if err != nil {

View on GitHub (pinned to a1189de023)

Solutions

  1. Run `skaffold build` (or `skaffold run --no-prune`) before diagnose so all artifacts have tags
  2. Verify each artifact's image name in skaffold.yaml matches what was built
  3. Delete stale cache and rebuild so the tags map contains every configured image

Example fix

// before: diagnose without building the newly added artifact
skaffold diagnose
// error: getting tag for image new-service
// after
skaffold build && skaffold diagnose
Defensive patterns

Strategy: validation

Validate before calling

for _, a := range cfg.Artifacts() {
	if _, ok := tags[a.ImageName]; !ok {
		return fmt.Errorf("run skaffold build first; no tag for %s", a.ImageName)
	}
}

Try / catch

if err := CheckArtifacts(ctx, cfg, tags, out); err != nil && strings.HasPrefix(err.Error(), "getting tag for image") {
	log.Warnf("stale/incomplete tags map: %v", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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