GoogleContainerTools/skaffold · error
found duplicate container name %s in custom action. Containe
Error message
found duplicate container name %s in custom action. Container names must be unique
What it means
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.
Source
Thrown at pkg/skaffold/schema/validation/validation.go:750
// - makes sure that each custom action name is unique
// - makes sure that each custom action container name is unique
func validateCustomActionsNames(runCtx *runcontext.RunContext) (errs []error) {
acs := []latest.Action{}
seenAcs := map[string]bool{}
seenConts := map[string]bool{}
for _, pipeline := range runCtx.GetPipelines() {
acs = append(acs, pipeline.CustomActions...)
}
for _, a := range acs {
if _, found := seenAcs[a.Name]; found {
errs = append(errs, fmt.Errorf("found duplicate custom action %s. Custom action names must be unique", a.Name))
}
for _, c := range a.Containers {
if _, found := seenConts[c.Name]; found {
errs = append(errs, fmt.Errorf("found duplicate container name %s in custom action. Container names must be unique", c.Name))
}
seenConts[c.Name] = true
}
seenAcs[a.Name] = true
}
return
}
// validateCustomActionsLists
// - makes sure that each custom action has one or more containers
func validateCustomActionsLists(runCtx *runcontext.RunContext) (errs []error) {
acs := []latest.Action{}
for _, pipeline := range runCtx.GetPipelines() {
acs = append(acs, pipeline.CustomActions...)
}View on GitHub (pinned to a1189de023)
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
Example fix
# before
customActions:
- name: deploy-check
containers:
- name: runner
image: alpine
- name: runner
image: busybox
# after
customActions:
- name: deploy-check
containers:
- name: runner
image: alpine
- name: verifier
image: busybox Defensive patterns
Strategy: validation
Validate before calling
func validateContainerNames(action CustomAction) error {
seen := map[string]bool{}
for _, c := range action.Containers {
if seen[c.Name] {
return fmt.Errorf("duplicate container name %q in custom action %q", c.Name, action.Name)
}
seen[c.Name] = true
}
return nil
} Type guard
null
Try / catch
null
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- custom action %s doesn't have containers. custom actions mus
- custom action %s have more than one execution mode defined.
- creating skaffold network %s: %w
- action %v not found for local execution mode
- getting imageID for %q: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/ab2d8ff4329278fa.
Report an issue: GitHub.