{"record":{"id":"dc1ade0239b47365","repo":"GoogleContainerTools/skaffold","slug":"unknown-build-dependency-q-for-artifact-q","errorCode":null,"errorMessage":"unknown build dependency %q for artifact %q","messagePattern":"unknown build dependency %q for artifact %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/validation/validation.go","lineNumber":253,"sourceCode":"\n// dfs runs a Depth First Search algorithm for cycle detection in a directed graph\nfunc dfs(artifact *latest.Artifact, visited, marked map[string]bool, artifacts map[string]*latest.Artifact) error {\n\tif marked[artifact.ImageName] {\n\t\treturn fmt.Errorf(\"cycle detected in build dependencies involving %q\", artifact.ImageName)\n\t}\n\tmarked[artifact.ImageName] = true\n\tdefer func() {\n\t\tmarked[artifact.ImageName] = false\n\t}()\n\tif visited[artifact.ImageName] {\n\t\treturn nil\n\t}\n\tvisited[artifact.ImageName] = true\n\n\tfor _, dep := range artifact.Dependencies {\n\t\td, found := artifacts[dep.ImageName]\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"unknown build dependency %q for artifact %q\", dep.ImageName, artifact.ImageName)\n\t\t}\n\t\tif err := dfs(d, visited, marked, artifacts); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// validateValidDependencyAliases makes sure that artifact dependency aliases are valid.\n// docker and custom builders require aliases match [a-zA-Z_][a-zA-Z0-9_]* pattern\nfunc validateValidDependencyAliases(cfgs *parser.SkaffoldConfigSet, artifacts []*latest.Artifact) (cfgErrs []ErrorWithLocation) {\n\tfor i, a := range artifacts {\n\t\tif a.DockerArtifact == nil && a.CustomArtifact == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor j, d := range a.Dependencies {\n\t\t\tif !dependencyAliasPattern.MatchString(d.Alias) {\n\t\t\t\tcfgErrs = append(cfgErrs, ErrorWithLocation{","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/validation/validation.go#L235-L271","documentation":"While walking the dependency graph, dfs looks up each dependency's imageName in the map of defined artifacts. If a dependency references an image that is not defined as an artifact in the config, validation fails because there is nothing to build and no alias mapping for it.","triggerScenarios":"An artifact's buildDependencies[].image names an image that has no corresponding entry under build.artifacts, so artifacts[dep.ImageName] lookup fails.","commonSituations":"Typo in the dependency image name, referencing an external image (from a registry) as a build dependency, or deleting an artifact but leaving others depending on it.","solutions":["Fix the dependency image name to exactly match the image name of a defined artifact","Add the missing artifact to build.artifacts if it should be built","Remove the dependency if the referenced image is external — external images are not build dependencies"],"exampleFix":"// before\nartifacts:\n  - image: app\n    requires: [{ image: ap-typo }]\n// after\nartifacts:\n  - image: base\n  - image: app\n    requires: [{ image: base }]","handlingStrategy":"validation","validationCode":"// Go: every dependency must name a defined artifact\nfunc unknownDeps(deps map[string][]string, defined map[string]bool) []string {\n\tvar unknown []string\n\tfor src, ds := range deps {\n\t\tfor _, d := range ds {\n\t\t\tif !defined[d] {\n\t\t\t\tunknown = append(unknown, src+\" -> \"+d)\n\t\t\t}\n\t\t}\n\t}\n\treturn unknown\n}","typeGuard":null,"tryCatchPattern":"if bad := unknownDeps(depGraph, definedArtifacts); len(bad) > 0 {\n\treturn fmt.Errorf(\"dependencies reference undefined artifacts: %v\", bad)\n}","preventionTips":["Copy/paste artifact image names rather than retyping them to avoid typos","Only reference images defined in build.artifacts — external images cannot be build dependencies","Grep for removed artifacts still referenced in requires blocks"],"tags":["skaffold","build-dependencies","config-validation"],"backgroundTag":"unknown-dependency-reference","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"}