GoogleContainerTools/skaffold · error

creating components: %w

Error message

creating components: %w

What it means

getTagger handles the customTemplate tag strategy by calling CreateComponents to instantiate each named component tagger. This error wraps any failure from CreateComponents — duplicate names (744), nested customTemplate (745), or unknown component types (746) — so the custom template tagger cannot be built.

Source

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

	case t.ShaTagger != nil:
		return &ChecksumTagger{}, nil

	case t.GitTagger != nil:
		return NewGitCommit(t.GitTagger.Prefix, t.GitTagger.Variant, t.GitTagger.IgnoreChanges)

	case t.DateTimeTagger != nil:
		return NewDateTimeTagger(t.DateTimeTagger.Format, t.DateTimeTagger.TimeZone), nil

	case t.InputDigest != nil:
		graph := graph.ToArtifactGraph(runCtx.Artifacts())
		return NewInputDigestTagger(runCtx, graph)

	case t.CustomTemplateTagger != nil:
		components, err := CreateComponents(runCtx, t.CustomTemplateTagger)

		if err != nil {
			return nil, fmt.Errorf("creating components: %w", err)
		}

		return NewCustomTemplateTagger(runCtx, t.CustomTemplateTagger.Template, components)

	default:
		return nil, fmt.Errorf("unknown tagger for strategy %+v", t)
	}
}

// CreateComponents creates a map of taggers for CustomTemplateTagger
func CreateComponents(runCtx *runcontext.RunContext, t *latest.CustomTemplateTagger) (map[string]Tagger, error) {
	components := map[string]Tagger{}

	for _, taggerComponent := range t.Components {
		name, c := taggerComponent.Name, taggerComponent.Component

		if _, ok := components[name]; ok {
			return nil, fmt.Errorf("multiple components with name %s", name)

View on GitHub (pinned to a1189de023)

Solutions

  1. Read the wrapped inner error to identify the bad component
  2. Deduplicate component names in tagPolicy.customTemplate.components
  3. Replace nested customTemplate components with supported ones (envTemplate, sha256, gitCommit, dateTime, inputDigest)
  4. Set exactly one strategy field per component

Example fix

// before
tagPolicy:
  customTemplate:
    template: "{{.A}}-{{.B}}"
    components:
      - name: A
        sha256: {}
      - name: A
        dateTime: {}

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

Strategy: validation

Validate before calling

for _, c := range tp.CustomTemplateTagger.Components {
    if c.Name == "" || (c.EnvTemplateTagger == nil && c.SHA256 == nil && c.GitCommit == nil && c.DateTime == nil && c.InputDigest == nil) {
        return fmt.Errorf("invalid custom template component %q", c.Name)
    }
}

Try / catch

t, err := tag.NewTaggerMux(runCtx)
var cfgErr error
if errors.As(err, &cfgErr) && strings.Contains(err.Error(), "creating components") {
    // fix tagPolicy.customTemplate and retry once after config reload
}

Prevention

When it happens

Trigger: A pipeline's tagPolicy.customTemplate block whose components list contains invalid entries: duplicate component names, a component that is itself a customTemplate, or a component with no recognized strategy field.

Common situations: Copy-pasted component blocks with the same name; accidentally nesting customTemplate inside customTemplate; typos in component keys so no strategy field is recognized; schema version drift changing component shapes.

Related errors


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