GoogleContainerTools/skaffold · error

custom test command must not be empty;

Error message

custom test command must not be empty;

What it means

Validation error from validateCustomTest: a `custom` test entry in skaffold.yaml's test section defines an empty command. Custom tests must specify the command to execute; the error is reported with the YAML location of the offending custom test.

Source

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

	for _, a := range acs {
		if a.ExecutionModeConfig.KubernetesClusterExecutionMode != nil && a.ExecutionModeConfig.LocalExecutionMode != nil {
			errs = append(errs, fmt.Errorf("custom action %s have more than one execution mode defined. custom actions must have only one execution mode", a.Name))
		}
	}

	return
}

// validateCustomTest
// - 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]),

View on GitHub (pinned to a1189de023)

Solutions

  1. Set a non-empty command string on the customTest entry
  2. Remove the empty customTest entry if it is not needed
  3. Check the YAML location reported in the error to find the exact offending entry

Example fix

# before
test:
- customTests:
  - command: ""
# after
test:
- customTests:
  - command: "./scripts/run-custom-tests.sh"
Defensive patterns

Strategy: validation

Validate before calling

func requireCommand(tc TestCase) error {
	for _, ct := range tc.CustomTests {
		if strings.TrimSpace(ct.Command) == "" {
			return fmt.Errorf("customTest %v has empty command", tc)
		}
	}
	return nil
}

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Processing a skaffold.yaml (via ProcessToErrorWithLocation) where any test case's customTests entry has `command: ""` or omits `command`.

Common situations: Adding a customTest stanza and forgetting the command; a variable/template expansion that resolves to empty; commenting out the command line while leaving the entry.

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/e4557c065b9a54d5. Report an issue: GitHub.