{"record":{"id":"6be0298f8a9c8428","repo":"GoogleContainerTools/skaffold","slug":"duplicate-image-q-found-in-sources-s-and-s-art","errorCode":null,"errorMessage":"duplicate image %q found in sources %s and %s: artifact image names must be unique across all configurations","messagePattern":"duplicate image %q found in sources (.+?) and (.+?): artifact image names must be unique across all configurations","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/validation/validation.go","lineNumber":165,"sourceCode":"\t\t\t})\n\t\t}\n\t}\n\treturn\n}\n\n// validateImageNames makes sure the artifact image names are unique and valid base names,\n// without tags nor digests.\nfunc validateImageNames(configs parser.SkaffoldConfigSet) (errs []ErrorWithLocation) {\n\tseen := make(map[string]string)\n\tarMap := make(map[string]*latest.Artifact)\n\n\tfor _, c := range configs {\n\t\tfor i, a := range c.Build.Artifacts {\n\t\t\tcurLines := c.YAMLInfos.Locate(c.Build.Artifacts[i])\n\t\t\tif prevSource, found := seen[a.ImageName]; found {\n\t\t\t\tprevLines := c.YAMLInfos.Locate(arMap[c.Build.Artifacts[i].ImageName])\n\t\t\t\terrs = append(errs, ErrorWithLocation{\n\t\t\t\t\tError: fmt.Errorf(\"duplicate image %q found in sources %s and %s: artifact image names must be unique across all configurations\",\n\t\t\t\t\t\ta.ImageName, prevSource, c.SourceFile),\n\t\t\t\t\tLocation: curLines,\n\t\t\t\t})\n\t\t\t\terrs = append(errs, ErrorWithLocation{\n\t\t\t\t\tError: fmt.Errorf(\"duplicate image %q found in sources %s and %s: artifact image names must be unique across all configurations\",\n\t\t\t\t\t\ta.ImageName, prevSource, c.SourceFile),\n\t\t\t\t\tLocation: prevLines,\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tseen[a.ImageName] = c.SourceFile\n\t\t\tarMap[a.ImageName] = a\n\t\t\tparsed, err := docker.ParseReference(a.ImageName)\n\t\t\tif err != nil {\n\t\t\t\terrs = append(errs, wrapWithContext(c, ErrorWithLocation{\n\t\t\t\t\tError:    fmt.Errorf(\"invalid image %q: %w\", a.ImageName, err),\n\t\t\t\t\tLocation: curLines,","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/validation/validation.go#L147-L183","documentation":"validateImageNames enforces that artifact image names are unique across ALL configurations in a multi-config skaffold project. When an artifact's ImageName was already registered from another (or the same) source file, it records an ErrorWithLocation pointing at the current occurrence's YAML lines, listing both source files. This is the 'current location' variant of the duplicate report.","triggerScenarios":"Running validation (via skaffold config load/parse) when two artifacts in different configs (or config + dependency overrides) declare the same image: name.","commonSituations":"Merging multiple skaffold.yaml configs where two teams independently named an artifact 'app'; a remote dependency config re-declaring an image already defined locally.","solutions":["Rename one of the duplicate artifacts' image name so each is unique across all configs","Check which files the message names (sources A and B) and remove the redundant artifact definition","If intentional reuse, factor the artifact into a shared config and reference it instead of duplicating"],"exampleFix":"# before (two configs)\nbuild:\n  artifacts:\n    - image: app\n# after\nbuild:\n  artifacts:\n    - image: frontend-app","handlingStrategy":"validation","validationCode":"func checkUniqueImages(configs []*latest.SkaffoldConfig) error {\n\tseen := map[string]string{}\n\tfor _, c := range configs {\n\t\tfor _, a := range c.Build.Artifacts {\n\t\t\tif prev, ok := seen[a.ImageName]; ok {\n\t\t\t\treturn fmt.Errorf(\"duplicate image %q in %s and %s\", a.ImageName, prev, c.SourceFile)\n\t\t\t}\n\t\t\tseen[a.ImageName] = c.SourceFile\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"var locErr []validation.ErrorWithLocation\nif err := validation.ProcessErrors(errs); err != nil { /* use ErrorWithLocation to surface file:line */ }","preventionTips":["Enforce unique artifact image names in CI before skaffold runs","Namespace artifacts per team/service prefix (e.g. team-app)","Review imported dependency configs for image name collisions"],"tags":["validation","config","duplicate"],"backgroundTag":"duplicate-artifact-image-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"}