GoogleContainerTools/skaffold · error
unknown tagger for strategy %+v
Error message
unknown tagger for strategy %+v
What it means
getTagger switches over the fields of the latest.TagPolicy struct; if none of the known strategy pointers (sha256, envTemplate, gitCommit, dateTime, inputDigest, customTemplate) is set, it falls through to the default case and reports the whole policy as unknown. Skaffold cannot pick a tagging implementation for an empty or unrecognized policy.
Source
Thrown at pkg/skaffold/tag/tagger_mux.go:88
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)
}
switch {
case c.EnvTemplateTagger != nil:
components[name], _ = NewEnvTemplateTagger(c.EnvTemplateTagger.Template)
View on GitHub (pinned to a1189de023)
Solutions
- Set exactly one tag strategy in tagPolicy, e.g. tagPolicy: {sha256: {}}
- Check for YAML typos in the tagPolicy key name (must be a recognized strategy)
- If building TagPolicy in code, assign one of the oneof strategy fields
Example fix
// before
build:
tagPolicy: {}
// after
build:
tagPolicy:
sha256: {} Defensive patterns
Strategy: validation
Validate before calling
func hasTagStrategy(tp latest.TagPolicy) bool {
return tp.Sha256Tagger != nil || tp.EnvTemplateTagger != nil ||
tp.GitTagger != nil || tp.DateTimeTagger != nil ||
tp.InputDigest != nil || tp.CustomTemplateTagger != nil
}
// reject configs where hasTagStrategy(p.Build.TagPolicy) == false Try / catch
t, err := tag.NewTaggerMux(runCtx)
if err != nil && strings.Contains(err.Error(), "unknown tagger for strategy") {
return fmt.Errorf("config error: set a tagPolicy strategy (e.g. sha256): %w", err)
} Prevention
- Always set exactly one tagPolicy strategy in skaffold.yaml
- Avoid programmatic TagPolicy construction without a oneof member
- Check YAML indentation so strategy keys parse into the right struct field
When it happens
Trigger: A Build.TagPolicy value where no strategy field is populated (e.g. tagPolicy: {} or a policy struct constructed programmatically without setting any oneof member), passed to getTagger via NewTaggerMux.
Common situations: Empty tagPolicy in skaffold.yaml; partial profile merges that clear the tag policy; constructing latest.TagProfile programmatically and forgetting to set a strategy; YAML key typos so the field lands nowhere.
Related errors
- getting tagger: %w
- no valid tagger found for artifact: %q
- creating tagger: %w
- multiple components with name %s
- unknown component for custom template: %s %+v
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/9319bebb475ee129.
Report an issue: GitHub.