GoogleContainerTools/skaffold · error

found duplicate container name '%s' in 'verify' test cases.

Error message

found duplicate container name '%s' in 'verify' test cases. 'verify' container names must be unique

What it means

Within verify test cases, the container names (tc.Container.Name) must be unique across all pipelines; Kubernetes pod container names must be unique anyway. validateVerifyTests tracks seen container names and errors on duplicates.

Source

Thrown at pkg/skaffold/schema/validation/validation.go:723

}

// validateVerifyTests
// - makes sure that each test name is unique
// - makes sure that each container name is unique
func validateVerifyTests(runCtx *runcontext.RunContext) []error {
	var errs []error
	seenTestName := map[string]bool{}
	seenContainerName := map[string]bool{}
	tcs := []*latest.VerifyTestCase{}
	for _, pipeline := range runCtx.GetPipelines() {
		tcs = append(tcs, pipeline.Verify...)
	}
	for _, tc := range tcs {
		if _, ok := seenTestName[tc.Name]; ok {
			errs = append(errs, fmt.Errorf("found duplicate test name '%s' in 'verify' test cases. 'verify' test case names must be unique", tc.Name))
		}
		if _, ok := seenContainerName[tc.Container.Name]; ok {
			errs = append(errs, fmt.Errorf("found duplicate container name '%s' in 'verify' test cases. 'verify' container names must be unique", tc.Container.Name))
		}
		seenTestName[tc.Name] = true
		seenContainerName[tc.Container.Name] = true
	}
	return errs
}

// validateCustomActions
// - 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...)
	}

View on GitHub (pinned to a1189de023)

Solutions

  1. Give each verify test case's container a unique `container.name`
  2. Remove the duplicated test case if unintended
  3. Namespace container names per config/module when using multiple configs

Example fix

# before
verify:
  - name: unit
    container: { name: tester, image: tester:1 }
  - name: e2e
    container: { name: tester, image: tester:2 }
# after
verify:
  - name: unit
    container: { name: unit-tester, image: tester:1 }
  - name: e2e
    container: { name: e2e-tester, image: tester:2 }
Defensive patterns

Strategy: validation

Validate before calling

const names = configs.flatMap(c => (c.verify ?? []).map(t => t.container?.name)).filter(Boolean);
const dupes = names.filter((n, i) => names.indexOf(n) !== i);
if (dupes.length) throw new Error(`duplicate verify container names: ${[...new Set(dupes)].join(', ')}`);

Try / catch

try {
  await skaffold.verify(config);
} catch (e) {
  if (/duplicate container name .* in 'verify'/.test(e.message)) {
    console.error('Give each verify container a unique name');
  } else throw e;
}

Prevention

When it happens

Trigger: Two verify test cases (in any pipeline of the run context) declare the same `container.name:`, processed via ProcessWithRunContext.

Common situations: Duplicating a verify block and changing only the test name/image but not the container name, or merging multiple skaffold configs that both use a generic name like 'test'.

Related errors


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