{"record":{"id":"ab2d8ff4329278fa","repo":"GoogleContainerTools/skaffold","slug":"found-duplicate-container-name-s-in-custom-action","errorCode":null,"errorMessage":"found duplicate container name %s in custom action. Container names must be unique","messagePattern":"found duplicate container name (.+?) in custom action\\. Container names must be unique","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/validation/validation.go","lineNumber":750,"sourceCode":"// - makes sure that each custom action name is unique\n// - makes sure that each custom action container name is unique\nfunc validateCustomActionsNames(runCtx *runcontext.RunContext) (errs []error) {\n\tacs := []latest.Action{}\n\tseenAcs := map[string]bool{}\n\tseenConts := map[string]bool{}\n\n\tfor _, pipeline := range runCtx.GetPipelines() {\n\t\tacs = append(acs, pipeline.CustomActions...)\n\t}\n\n\tfor _, a := range acs {\n\t\tif _, found := seenAcs[a.Name]; found {\n\t\t\terrs = append(errs, fmt.Errorf(\"found duplicate custom action %s. Custom action names must be unique\", a.Name))\n\t\t}\n\n\t\tfor _, c := range a.Containers {\n\t\t\tif _, found := seenConts[c.Name]; found {\n\t\t\t\terrs = append(errs, fmt.Errorf(\"found duplicate container name %s in custom action. Container names must be unique\", c.Name))\n\t\t\t}\n\t\t\tseenConts[c.Name] = true\n\t\t}\n\n\t\tseenAcs[a.Name] = true\n\t}\n\n\treturn\n}\n\n// validateCustomActionsLists\n// - makes sure that each custom action has one or more containers\nfunc validateCustomActionsLists(runCtx *runcontext.RunContext) (errs []error) {\n\tacs := []latest.Action{}\n\n\tfor _, pipeline := range runCtx.GetPipelines() {\n\t\tacs = append(acs, pipeline.CustomActions...)\n\t}","sourceCodeStart":732,"sourceCodeEnd":768,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/validation/validation.go#L732-L768","documentation":"This validation error comes from Skaffold's schema validation pass. It fires when a `customAction` defines two or more `containers` entries with the same `name`. Custom actions require unique container names so that exec/step references can resolve unambiguously, and validateCustomActionsNames rejects duplicates during ProcessWithRunContext.","triggerScenarios":"Running any skaffold command that processes the config (via ProcessWithRunContext) when a customActions entry in skaffold.yaml lists two containers sharing the same name field within the same action.","commonSituations":"Copy-pasting a container stanza inside a customAction and forgetting to rename it; generating skaffold.yaml programmatically where names are templated incorrectly; merging config fragments that both define a container named e.g. 'build' in the same action.","solutions":["Rename one of the duplicate container entries in the customAction so every container name within a single action is unique","Check for copy-pasted container blocks in skaffold.yaml under customActions and give each a distinct name","Run `skaffold config` or re-run the command after edits to confirm validation passes"],"exampleFix":"# before\ncustomActions:\n- name: deploy-check\n  containers:\n  - name: runner\n    image: alpine\n  - name: runner\n    image: busybox\n# after\ncustomActions:\n- name: deploy-check\n  containers:\n  - name: runner\n    image: alpine\n  - name: verifier\n    image: busybox","handlingStrategy":"validation","validationCode":"func validateContainerNames(action CustomAction) error {\n\tseen := map[string]bool{}\n\tfor _, c := range action.Containers {\n\t\tif seen[c.Name] {\n\t\t\treturn fmt.Errorf(\"duplicate container name %q in custom action %q\", c.Name, action.Name)\n\t\t}\n\t\tseen[c.Name] = true\n\t}\n\treturn nil\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Give each container in an action a unique, descriptive name","Review copy-pasted container blocks for unrenamed name fields","Template-generated configs: assert name uniqueness in your generator","Run schema validation locally before CI"],"tags":["skaffold","yaml-validation","custom-actions","duplicate-name"],"backgroundTag":"duplicate-name-validation","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"}