GoogleContainerTools/skaffold · error

CONFIG_DUPLICATE_NAMES_SAME_FILE_ERR

CONFIG_DUPLICATE_NAMES_SAME_FILE_ERR

Error message

multiple skaffold configs named %q found in file %q

What it means

DuplicateConfigNamesInSameFileErr fires when two configurations inside the same file share the same `metadata.name`. Named configs must be unique within a file so cross-file dependency resolution can address them unambiguously. Code CONFIG_DUPLICATE_NAMES_SAME_FILE_ERR with suggestion CONFIG_CHANGE_NAMES.

Source

Thrown at pkg/skaffold/schema/errors/errors.go:95

				},
			},
		})
}

// ZeroConfigsParsedErr specifies that the config file is empty
func ZeroConfigsParsedErr(file string) error {
	msg := fmt.Sprintf("failed to get any valid configs from file %q", file)
	return sErrors.NewError(errors.New(msg),
		&proto.ActionableErr{
			Message: msg,
			ErrCode: proto.StatusCode_CONFIG_ZERO_FOUND_ERR,
		})
}

// DuplicateConfigNamesInSameFileErr specifies that multiple configs have the same name in current config file
func DuplicateConfigNamesInSameFileErr(config, file string) error {
	msg := fmt.Sprintf("multiple skaffold configs named %q found in file %q", config, file)
	return sErrors.NewError(errors.New(msg),
		&proto.ActionableErr{
			Message: msg,
			ErrCode: proto.StatusCode_CONFIG_DUPLICATE_NAMES_SAME_FILE_ERR,
			Suggestions: []*proto.Suggestion{
				{
					SuggestionCode: proto.SuggestionCode_CONFIG_CHANGE_NAMES,
					Action:         fmt.Sprintf("Change the name of one of the occurrences of config %q in file %q to make it unique", config, file),
				},
			},
		})
}

// DuplicateConfigNamesAcrossFilesErr specifies that multiple configs have the same name in different files
func DuplicateConfigNamesAcrossFilesErr(config, file1, file2 string) error {
	msg := fmt.Sprintf("skaffold config named %q found in multiple files: %q and %q", config, file1, file2)
	return sErrors.NewError(errors.New(msg),
		&proto.ActionableErr{
			Message: msg,

View on GitHub (pinned to a1189de023)

Solutions

  1. Rename one of the duplicate configs' `metadata.name` to a unique value.
  2. Merge the two documents into one if they are meant to be the same config.
  3. Move the second variant into a separate file if it is intentionally a distinct config.

Example fix

// before (two docs in one file)
metadata:
  name: my-app
---
metadata:
  name: my-app
// after
metadata:
  name: my-app
---
metadata:
  name: my-app-staging
Defensive patterns

Strategy: validation

Validate before calling

yq e 'select(documentIndex > 0)' -N skaffold.yaml 2>/dev/null
# or in CI: assert metadata.name values across all YAML docs are unique
names=$(yq e '.metadata.name // ""' skaffold.yaml | sort | uniq -d); test -z "$names" || echo "duplicates: $names"

Prevention

When it happens

Trigger: Parsing a multi-document skaffold.yaml where two `kind: Config` documents both define the same `metadata.name`, then resolving configs by name.

Common situations: Copy-pasting a config document into the same file to create a variant (e.g. staging/prod) but forgetting to rename `metadata.name`.

Related errors


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