hashicorp/nomad · error
check type %+q not valid
Error message
check type %+q not valid
What it means
Nomad validates each service check's type while translating to a Consul check registration. Only known check types (http, tcp, grpc, script, ttl, etc. per the switch) are supported; anything else falls to the default case and is rejected before being sent to Consul.
Source
Thrown at command/agent/consul/service_client.go:2060
case structs.ServiceCheckTCP:
chkReg.TCP = net.JoinHostPort(host, strconv.Itoa(port))
case structs.ServiceCheckScript:
chkReg.TTL = (check.Interval + ttlCheckBuffer).String()
// As of Consul 1.0.0 setting TTL and Interval is a 400
chkReg.Interval = ""
case structs.ServiceCheckGRPC:
chkReg.GRPC = fmt.Sprintf("%s/%s", net.JoinHostPort(host, strconv.Itoa(port)), check.GRPCService)
chkReg.GRPCUseTLS = check.GRPCUseTLS
if check.TLSSkipVerify {
chkReg.TLSSkipVerify = true
}
chkReg.TLSServerName = check.TLSServerName
default:
return nil, fmt.Errorf("check type %+q not valid", check.Type)
}
return &chkReg, nil
}
// isNomadClient returns true if id represents a Nomad Client registration.
func isNomadClient(id string) bool {
return strings.HasPrefix(id, nomadClientPrefix)
}
// isNomadServer returns true if id represents a Nomad Server registration.
func isNomadServer(id string) bool {
return strings.HasPrefix(id, nomadServerPrefix)
}
// isNomadAgent returns true if id represents a Nomad Client or Server registration.
func isNomadAgent(id string) bool {
return isNomadClient(id) || isNomadServer(id)
}View on GitHub (pinned to 482b49bf1a)
Solutions
- Correct the check type to a supported value: http, tcp, grpc, script, or ttl.
- Check type spelling and case (must be lowercase).
- If you need TLS http checks, use type="http" with tls_skip_verify/tls_server_name, not type="https".
- Upgrade Nomad if you need a check type introduced in a newer release.
Example fix
// before
check { type = "https", path = "/health" }
// after
check { type = "http", path = "/health", tls_skip_verify = true } Defensive patterns
Strategy: validation
Validate before calling
var validCheckTypes = map[string]bool{"http": true, "tcp": true, "grpc": true, "script": true, "ttl": true}
if !validCheckTypes[strings.ToLower(check.Type)] {
return fmt.Errorf("unsupported check type %q", check.Type)
} Type guard
func isValidCheckType(t string) bool {
switch t {
case "http", "tcp", "grpc", "script", "ttl":
return true
}
return false
} Try / catch
try {
nomad.jobRegister(job)
} catch err {
if strings.Contains(err.Error(), "not valid") && strings.Contains(err.Error(), "check type") {
log.Error("fix check type in job spec", "err", err)
}
} Prevention
- Validate job specs with `nomad job validate` in CI pipelines.
- Keep a shared HCL module with whitelisted check types.
- Never copy raw Consul check definitions into Nomad job files without translating types.
- Confirm type is lowercase in the job file.
When it happens
Trigger: Submitting a job whose service check `type` field is misspelled or unsupported (e.g. type="https" or type="HTTP" uppercase) so it matches none of the switch cases in makeAgentServiceCheck.
Common situations: Typo in HCL check type; copying Consul-native check types Nomad doesn't accept; older Nomad version lacking a newer check type added later.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- expose may only be set for Consul service checks
- on_update may only be set to ignore_warnings for Consul serv
- success_before_passing may only be set for Consul service ch
- failures_before_critical may only be set for Consul service
- failures_before_warning may only be set for Consul service c
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/121246f709607953.
Report an issue: GitHub.