{"record":{"id":"294c09f7a8399814","repo":"GoogleContainerTools/skaffold","slug":"config-duplicate-names-across-files-err","errorCode":"CONFIG_DUPLICATE_NAMES_ACROSS_FILES_ERR","errorMessage":"skaffold config named %q found in multiple files: %q and %q","messagePattern":"skaffold config named %q found in multiple files: %q and %q","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/errors/errors.go","lineNumber":111,"sourceCode":"func DuplicateConfigNamesInSameFileErr(config, file string) error {\n\tmsg := fmt.Sprintf(\"multiple skaffold configs named %q found in file %q\", config, file)\n\treturn sErrors.NewError(errors.New(msg),\n\t\t&proto.ActionableErr{\n\t\t\tMessage: msg,\n\t\t\tErrCode: proto.StatusCode_CONFIG_DUPLICATE_NAMES_SAME_FILE_ERR,\n\t\t\tSuggestions: []*proto.Suggestion{\n\t\t\t\t{\n\t\t\t\t\tSuggestionCode: proto.SuggestionCode_CONFIG_CHANGE_NAMES,\n\t\t\t\t\tAction:         fmt.Sprintf(\"Change the name of one of the occurrences of config %q in file %q to make it unique\", config, file),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n}\n\n// DuplicateConfigNamesAcrossFilesErr specifies that multiple configs have the same name in different files\nfunc DuplicateConfigNamesAcrossFilesErr(config, file1, file2 string) error {\n\tmsg := fmt.Sprintf(\"skaffold config named %q found in multiple files: %q and %q\", config, file1, file2)\n\treturn sErrors.NewError(errors.New(msg),\n\t\t&proto.ActionableErr{\n\t\t\tMessage: msg,\n\t\t\tErrCode: proto.StatusCode_CONFIG_DUPLICATE_NAMES_ACROSS_FILES_ERR,\n\t\t\tSuggestions: []*proto.Suggestion{\n\t\t\t\t{\n\t\t\t\t\tSuggestionCode: proto.SuggestionCode_CONFIG_CHANGE_NAMES,\n\t\t\t\t\tAction:         fmt.Sprintf(\"Change the name of config %q in file %q or file %q to make it unique\", config, file1, file2),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n}\n\n// ConfigProfileActivationErr specifies that profile activation failed for this config\nfunc ConfigProfileActivationErr(config, file string, err error) error {\n\treturn sErrors.NewError(err,\n\t\t&proto.ActionableErr{\n\t\t\tMessage: fmt.Sprintf(\"failed to apply profiles to config %q defined in file %q: %v\", config, file, err),\n\t\t\tErrCode: proto.StatusCode_CONFIG_APPLY_PROFILES_ERR,","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/errors/errors.go#L93-L129","documentation":"DuplicateConfigNamesAcrossFilesErr fires when configs with the same `metadata.name` exist in two different files being loaded together, making name-based references (config dependencies) ambiguous. Code CONFIG_DUPLICATE_NAMES_ACROSS_FILES_ERR with suggestion CONFIG_CHANGE_NAMES.","triggerScenarios":"Loading multiple config files (e.g. via `-f` flags or config dependency imports) where two files each define a config named identically.","commonSituations":"Teams sharing a common skaffold config module where both repos coincidentally named their config `api` or `web`, then combining them with multiple `-f` flags.","solutions":["Rename the config in one of the files so names are globally unique across the loaded set.","Remove the duplicate `-f` flag / import if one file was included by mistake.","Namespace names per project, e.g. `teamA-api` vs `teamB-api`."],"exampleFix":"// before: both skaffold.yaml and ../shared/skaffold.yaml contain\nmetadata:\n  name: api\n// after: rename in the shared file\nmetadata:\n  name: shared-api","handlingStrategy":"validation","validationCode":"# across all loaded files:\nyq e '.metadata.name // \"\"' skaffold.yaml ../shared/skaffold.yaml | sort | uniq -d\n# empty output means no cross-file duplicate names","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Namespace config names by team/repo (e.g. `teamA-api`) to avoid collisions in shared setups.","Keep a registry of config names used across repos that are loaded together.","Lint the union of all -f files for duplicate metadata.name in CI."],"tags":["config","naming","multi-file"],"backgroundTag":"duplicate-config-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"}