hashicorp/nomad · error

invalid check type (%q), must be one of %s

Error message

invalid check type (%q), must be one of %s

What it means

ServiceCheck.validateCommon found a check `type` (case-insensitive) not in the allowable set for the provider (nomad or consul); the message lists the accepted types.

Source

Thrown at nomad/structs/services.go:262

	// Set task name if not already set
	if sc.TaskName == "" && taskName != "group" {
		sc.TaskName = taskName
	}

	// Ensure OnUpdate defaults to require_healthy (i.e. healthiness check)
	if sc.OnUpdate == "" {
		sc.OnUpdate = OnUpdateRequireHealthy
	}
}

// validateCommon validates the parts of ServiceCheck shared across providers.
func (sc *ServiceCheck) validateCommon(allowableTypes []string) error {
	// validate the type is allowable (different between nomad, consul checks)
	checkType := strings.ToLower(sc.Type)
	if !slices.Contains(allowableTypes, checkType) {
		s := strings.Join(allowableTypes, ", ")
		return fmt.Errorf(`invalid check type (%q), must be one of %s`, checkType, s)
	}

	// validate specific check types
	switch checkType {
	case ServiceCheckHTTP:
		if sc.Path == "" {
			return fmt.Errorf("http type must have http path")
		}
		checkPath, pathErr := url.Parse(sc.Path)
		if pathErr != nil {
			return fmt.Errorf("http type must have valid http path")
		}
		if checkPath.IsAbs() {
			return fmt.Errorf("http type must have relative http path")
		}
	case ServiceCheckScript:
		if sc.Command == "" {
			return fmt.Errorf("script type must have a valid script path")

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set the check type to one of the listed allowable types (e.g. tcp, http, grpc, script)
  2. Check for provider-specific type restrictions between Nomad and Consul checks
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nomad/structs/services.go:262 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/fb3a1c5df005a80b. Report an issue: GitHub.