{"record":{"id":"0518db59936eaa8c","repo":"GoogleContainerTools/skaffold","slug":"multiple-components-with-name-s","errorCode":null,"errorMessage":"multiple components with name %s","messagePattern":"multiple components with name (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/tag/tagger_mux.go","lineNumber":100,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"creating components: %w\", err)\n\t\t}\n\n\t\treturn NewCustomTemplateTagger(runCtx, t.CustomTemplateTagger.Template, components)\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown tagger for strategy %+v\", t)\n\t}\n}\n\n// CreateComponents creates a map of taggers for CustomTemplateTagger\nfunc CreateComponents(runCtx *runcontext.RunContext, t *latest.CustomTemplateTagger) (map[string]Tagger, error) {\n\tcomponents := map[string]Tagger{}\n\n\tfor _, taggerComponent := range t.Components {\n\t\tname, c := taggerComponent.Name, taggerComponent.Component\n\n\t\tif _, ok := components[name]; ok {\n\t\t\treturn nil, fmt.Errorf(\"multiple components with name %s\", name)\n\t\t}\n\n\t\tswitch {\n\t\tcase c.EnvTemplateTagger != nil:\n\t\t\tcomponents[name], _ = NewEnvTemplateTagger(c.EnvTemplateTagger.Template)\n\n\t\tcase c.ShaTagger != nil:\n\t\t\tcomponents[name] = &ChecksumTagger{}\n\n\t\tcase c.GitTagger != nil:\n\t\t\tcomponents[name], _ = NewGitCommit(c.GitTagger.Prefix, c.GitTagger.Variant, c.GitTagger.IgnoreChanges)\n\n\t\tcase c.DateTimeTagger != nil:\n\t\t\tcomponents[name] = NewDateTimeTagger(c.DateTimeTagger.Format, c.DateTimeTagger.TimeZone)\n\n\t\tcase c.InputDigest != nil:\n\t\t\tgraph := graph.ToArtifactGraph(runCtx.Artifacts())\n\t\t\tinputDigest, _ := NewInputDigestTagger(runCtx, graph)","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/tag/tagger_mux.go#L82-L118","documentation":"CreateComponents iterates tagPolicy.customTemplate.components and stores each tagger in a map keyed by component name. If two components share the same name the second would silently overwrite the first (or break template references), so Skaffold rejects the configuration with this error.","triggerScenarios":"A customTemplate tag policy whose components array contains two or more entries with the same `name` value, encountered when getTagger calls CreateComponents.","commonSituations":"Copy-pasting a component block and forgetting to rename it; generating components programmatically with a collision; merging YAML across profiles so duplicate name keys survive.","solutions":["Rename one of the duplicate components to a unique name","Update the customTemplate template string to reference the new name","Deduplicate the components list in skaffold.yaml"],"exampleFix":"// before\ncomponents:\n  - name: SHA\n    sha256: {}\n  - name: SHA\n    gitCommit: {}\n\n// after\ncomponents:\n  - name: SHA\n    sha256: {}\n  - name: GIT\n    gitCommit: {}","handlingStrategy":"validation","validationCode":"seen := map[string]bool{}\nfor _, c := range tp.CustomTemplateTagger.Components {\n    if seen[c.Name] {\n        return fmt.Errorf(\"duplicate component name %q\", c.Name)\n    }\n    seen[c.Name] = true\n}","typeGuard":null,"tryCatchPattern":"t, err := tag.NewTaggerMux(runCtx)\nif err != nil && strings.Contains(err.Error(), \"multiple components with name\") {\n    return fmt.Errorf(\"fix tagPolicy.customTemplate component names: %w\", err)\n}","preventionTips":["Enforce unique component names when generating config","Review profile merges for duplicated component blocks","Lint customTemplate templates so every referenced name exists once"],"tags":["skaffold","tagging","custom-template","config"],"backgroundTag":"duplicate-component-name","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}