GoogleContainerTools/skaffold · error

dependencies can use either command or paths, but not both

Error message

dependencies can use either command or paths, but not both

What it means

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`.

Source

Thrown at pkg/skaffold/schema/validation/validation.go:813

// - makes sure that command is not empty
// - makes sure that dependencies.ignore is only used in conjunction with dependencies.paths
func validateCustomTest(cfg *parser.SkaffoldConfigEntry, tcs []*latest.TestCase) (cfgErrs []ErrorWithLocation) {
	for i, tc := range tcs {
		for j, ct := range tc.CustomTests {
			if ct.Command == "" {
				cfgErrs = append(cfgErrs, ErrorWithLocation{
					Error:    fmt.Errorf("custom test command must not be empty;"),
					Location: cfg.YAMLInfos.Locate(&cfg.Test[i].CustomTests[j]),
				})
				return
			}

			if ct.Dependencies == nil {
				continue
			}
			if ct.Dependencies.Command != "" && ct.Dependencies.Paths != nil {
				cfgErrs = append(cfgErrs, ErrorWithLocation{
					Error:    fmt.Errorf("dependencies can use either command or paths, but not both"),
					Location: cfg.YAMLInfos.Locate(&cfg.Test[i].CustomTests[j]),
				})
			}
			if ct.Dependencies.Paths == nil && ct.Dependencies.Ignore != nil {
				cfgErrs = append(cfgErrs, ErrorWithLocation{
					Error:    fmt.Errorf("customTest has invalid dependencies; dependencies.ignore can only be used in conjunction with dependencies.paths"),
					Location: cfg.YAMLInfos.Locate(&cfg.Test[i].CustomTests[j]),
				})
			}
		}
	}
	return
}

func wrapWithContext(config *parser.SkaffoldConfigEntry, errs ...ErrorWithLocation) []ErrorWithLocation {
	var id string
	if config.Metadata.Name != "" {
		id = fmt.Sprintf("in module %q", config.Metadata.Name)

View on GitHub (pinned to a1189de023)

Solutions

  1. Delete either the dependencies.command or the dependencies.paths field, keeping only one
  2. 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)
  3. Re-run to confirm the located error is gone

Example fix

# before
- customTests:
  - command: ./run-tests.sh
    dependencies:
      command: ./list-deps.sh
      paths: ["src/**"]
# after
- customTests:
  - command: ./run-tests.sh
    dependencies:
      command: ./list-deps.sh
Defensive patterns

Strategy: validation

Validate before calling

func exclusiveDeps(ct CustomTest) error {
	d := ct.Dependencies
	if d != nil && d.Command != "" && len(d.Paths) > 0 {
		return fmt.Errorf("customTest dependencies: set command or paths, not both")
	}
	return nil
}

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Processing a skaffold.yaml where a customTest's `dependencies:` block contains both a non-empty `command` string and a non-nil `paths` list.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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