GoogleContainerTools/skaffold · error

unknown component for custom template: %s %+v

Error message

unknown component for custom template: %s %+v

What it means

CreateComponents' switch matches each component against known strategy fields; a component with none of envTemplate, sha256, gitCommit, dateTime, inputDigest, or customTemplate set falls to the default branch and is rejected. The error echoes the component name and its struct so the misconfiguration is visible.

Source

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

		case c.ShaTagger != nil:
			components[name] = &ChecksumTagger{}

		case c.GitTagger != nil:
			components[name], _ = NewGitCommit(c.GitTagger.Prefix, c.GitTagger.Variant, c.GitTagger.IgnoreChanges)

		case c.DateTimeTagger != nil:
			components[name] = NewDateTimeTagger(c.DateTimeTagger.Format, c.DateTimeTagger.TimeZone)

		case c.InputDigest != nil:
			graph := graph.ToArtifactGraph(runCtx.Artifacts())
			inputDigest, _ := NewInputDigestTagger(runCtx, graph)
			components[name] = inputDigest

		case c.CustomTemplateTagger != nil:
			return nil, fmt.Errorf("nested customTemplate components are not supported in skaffold (%s)", name)

		default:
			return nil, fmt.Errorf("unknown component for custom template: %s %+v", name, c)
		}
	}

	return components, nil
}

View on GitHub (pinned to a1189de023)

Solutions

  1. Give the component exactly one supported strategy field (envTemplate, sha256, gitCommit, dateTime, inputDigest)
  2. Fix the misspelled strategy key shown in the error's %+v dump
  3. Validate skaffold.yaml against the schema for your skaffold version

Example fix

// before
components:
  - name: SHA
    sha: {}

// after
components:
  - name: SHA
    sha256: {}
Defensive patterns

Strategy: validation

Validate before calling

supported := []func(*latest.TaggerComponent) bool{
    func(c *latest.TaggerComponent) bool { return c.EnvTemplateTagger != nil },
    func(c *latest.TaggerComponent) bool { return c.SHA256 != nil },
    func(c *latest.TaggerComponent) bool { return c.GitCommit != nil },
    func(c *latest.TaggerComponent) bool { return c.DateTime != nil },
    func(c *latest.TaggerComponent) bool { return c.InputDigest != nil },
}
for _, c := range comps {
    ok := false
    for _, f := range supported { if f(&c) { ok = true } }
    if !ok { return fmt.Errorf("component %q has no supported strategy", c.Name) }
}

Try / catch

t, err := tag.NewTaggerMux(runCtx)
if err != nil && strings.Contains(err.Error(), "unknown component for custom template") {
    return fmt.Errorf("check component strategy keys in skaffold.yaml: %w", err)
}

Prevention

When it happens

Trigger: A customTemplate.components entry that is empty or whose strategy key is misspelled/unknown (e.g. `sha: {}` instead of `sha256: {}`), reached when getTagger builds the tagger.

Common situations: YAML typos in strategy keys; empty component blocks left behind after edits; newer/older skaffold schema where a strategy field was renamed; generating config with tooling that emits unknown keys.

Related errors


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