GoogleContainerTools/skaffold · error

creating tagger: %w

Error message

creating tagger: %w

What it means

NewTaggerMux builds one Tagger per pipeline by calling getTagger on each pipeline's Build.TagPolicy. This error wraps any failure from getTagger, meaning the tag policy itself could not be instantiated — the mux construction aborts and no tagger is returned.

Source

Thrown at pkg/skaffold/tag/tagger_mux.go:46

type TaggerMux struct {
	byImageName map[string]Tagger
}

func (t *TaggerMux) GenerateTag(ctx context.Context, image latest.Artifact) (string, error) {
	tagger, found := t.byImageName[image.ImageName]
	if !found {
		return "", fmt.Errorf("no valid tagger found for artifact: %q", image.ImageName)
	}
	return tagger.GenerateTag(ctx, image)
}

func NewTaggerMux(runCtx *runcontext.RunContext) (Tagger, error) {
	pipelines := runCtx.GetPipelines()
	m := make(map[string]Tagger)
	for _, p := range pipelines {
		t, err := getTagger(runCtx, &p.Build.TagPolicy)
		if err != nil {
			return nil, fmt.Errorf("creating tagger: %w", err)
		}
		for _, a := range p.Build.Artifacts {
			m[a.ImageName] = t
		}
	}
	return &TaggerMux{byImageName: m}, nil
}

func getTagger(runCtx *runcontext.RunContext, t *latest.TagPolicy) (Tagger, error) {
	switch {
	case runCtx.CustomTag() != "":
		return &CustomTag{
			Tag: runCtx.CustomTag(),
		}, nil

	case t.EnvTemplateTagger != nil:
		return NewEnvTemplateTagger(t.EnvTemplateTagger.Template)

View on GitHub (pinned to a1189de023)

Solutions

  1. Inspect the wrapped inner error (use %w chain) to find which pipeline's tag policy failed
  2. Fix the offending Build.TagPolicy in skaffold.yaml (e.g. correct the customTemplate components)
  3. Run skaffold config validation/schema check before deploying

Example fix

// before
tagPolicy:
  customTemplate:
    template: "{{.UNKNOWN}}"

// after
tagPolicy:
  customTemplate:
    template: "{{.SHA}}"
    components:
      - name: SHA
        sha256: {}
Defensive patterns

Strategy: try-catch

Validate before calling

for _, p := range runCtx.GetPipelines() {
    if p.Build.TagPolicy == (latest.TagPolicy{}) {
        return fmt.Errorf("pipeline %s has empty tagPolicy", p.Name)
    }
}

Try / catch

tagger, err := tag.NewTaggerMux(runCtx)
if err != nil {
    return fmt.Errorf("skaffold tagger init failed: %w", err) // inspect wrapped cause
}

Prevention

When it happens

Trigger: Calling NewTaggerMux(runCtx) when any pipeline's Build.TagPolicy selects a strategy whose constructor fails: customTemplate with bad components (742), or a tag policy that matches no known strategy (743).

Common situations: Invalid customTemplate template/component definitions in skaffold.yaml; empty or malformed tagPolicy blocks; profiles that partially override tagPolicy leaving it invalid.

Related errors


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