{"record":{"id":"63c9bc8d2d15558b","repo":"GoogleContainerTools/skaffold","slug":"dependencies-can-use-either-command-or-paths-but","errorCode":null,"errorMessage":"dependencies can use either command or paths, but not both","messagePattern":"dependencies can use either command or paths, but not both","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/validation/validation.go","lineNumber":813,"sourceCode":"// - makes sure that command is not empty\n// - makes sure that dependencies.ignore is only used in conjunction with dependencies.paths\nfunc validateCustomTest(cfg *parser.SkaffoldConfigEntry, tcs []*latest.TestCase) (cfgErrs []ErrorWithLocation) {\n\tfor i, tc := range tcs {\n\t\tfor j, ct := range tc.CustomTests {\n\t\t\tif ct.Command == \"\" {\n\t\t\t\tcfgErrs = append(cfgErrs, ErrorWithLocation{\n\t\t\t\t\tError:    fmt.Errorf(\"custom test command must not be empty;\"),\n\t\t\t\t\tLocation: cfg.YAMLInfos.Locate(&cfg.Test[i].CustomTests[j]),\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif ct.Dependencies == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ct.Dependencies.Command != \"\" && ct.Dependencies.Paths != nil {\n\t\t\t\tcfgErrs = append(cfgErrs, ErrorWithLocation{\n\t\t\t\t\tError:    fmt.Errorf(\"dependencies can use either command or paths, but not both\"),\n\t\t\t\t\tLocation: cfg.YAMLInfos.Locate(&cfg.Test[i].CustomTests[j]),\n\t\t\t\t})\n\t\t\t}\n\t\t\tif ct.Dependencies.Paths == nil && ct.Dependencies.Ignore != nil {\n\t\t\t\tcfgErrs = append(cfgErrs, ErrorWithLocation{\n\t\t\t\t\tError:    fmt.Errorf(\"customTest has invalid dependencies; dependencies.ignore can only be used in conjunction with dependencies.paths\"),\n\t\t\t\t\tLocation: cfg.YAMLInfos.Locate(&cfg.Test[i].CustomTests[j]),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}\n\nfunc wrapWithContext(config *parser.SkaffoldConfigEntry, errs ...ErrorWithLocation) []ErrorWithLocation {\n\tvar id string\n\tif config.Metadata.Name != \"\" {\n\t\tid = fmt.Sprintf(\"in module %q\", config.Metadata.Name)","sourceCodeStart":795,"sourceCodeEnd":831,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/validation/validation.go#L795-L831","documentation":"A customTest's dependencies may be sourced either from a command (dynamic) or from explicit paths (static), but not both at once. validateCustomTest rejects dependencies blocks that specify both `command` and `paths`.","triggerScenarios":"Processing a skaffold.yaml where a customTest's `dependencies:` block contains both a non-empty `command` string and a non-nil `paths` list.","commonSituations":"Switching dependency strategy from paths to a command (or vice versa) and forgetting to delete the old field; merging team configs that each chose a different strategy.","solutions":["Delete either the dependencies.command or the dependencies.paths field, keeping only one","If you need both static and dynamic inputs, choose the strategy that fits and move the other inputs into it (e.g. fold static files into the command output)","Re-run to confirm the located error is gone"],"exampleFix":"# before\n- customTests:\n  - command: ./run-tests.sh\n    dependencies:\n      command: ./list-deps.sh\n      paths: [\"src/**\"]\n# after\n- customTests:\n  - command: ./run-tests.sh\n    dependencies:\n      command: ./list-deps.sh","handlingStrategy":"validation","validationCode":"func exclusiveDeps(ct CustomTest) error {\n\td := ct.Dependencies\n\tif d != nil && d.Command != \"\" && len(d.Paths) > 0 {\n\t\treturn fmt.Errorf(\"customTest dependencies: set command or paths, not both\")\n\t}\n\treturn nil\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Pick one dependency strategy per customTest and document it","When switching strategies, delete the other field in the same commit","Add a pre-commit lint that enforces command XOR paths"],"tags":["skaffold","yaml-validation","custom-test","dependencies"],"backgroundTag":"schema-validation-failed","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"}