{"record":{"id":"121246f709607953","repo":"hashicorp/nomad","slug":"check-type-q-not-valid","errorCode":null,"errorMessage":"check type %+q not valid","messagePattern":"check type %\\+q not valid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/consul/service_client.go","lineNumber":2060,"sourceCode":"\n\tcase structs.ServiceCheckTCP:\n\t\tchkReg.TCP = net.JoinHostPort(host, strconv.Itoa(port))\n\n\tcase structs.ServiceCheckScript:\n\t\tchkReg.TTL = (check.Interval + ttlCheckBuffer).String()\n\t\t// As of Consul 1.0.0 setting TTL and Interval is a 400\n\t\tchkReg.Interval = \"\"\n\n\tcase structs.ServiceCheckGRPC:\n\t\tchkReg.GRPC = fmt.Sprintf(\"%s/%s\", net.JoinHostPort(host, strconv.Itoa(port)), check.GRPCService)\n\t\tchkReg.GRPCUseTLS = check.GRPCUseTLS\n\t\tif check.TLSSkipVerify {\n\t\t\tchkReg.TLSSkipVerify = true\n\t\t}\n\t\tchkReg.TLSServerName = check.TLSServerName\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"check type %+q not valid\", check.Type)\n\t}\n\treturn &chkReg, nil\n}\n\n// isNomadClient returns true if id represents a Nomad Client registration.\nfunc isNomadClient(id string) bool {\n\treturn strings.HasPrefix(id, nomadClientPrefix)\n}\n\n// isNomadServer returns true if id represents a Nomad Server registration.\nfunc isNomadServer(id string) bool {\n\treturn strings.HasPrefix(id, nomadServerPrefix)\n}\n\n// isNomadAgent returns true if id represents a Nomad Client or Server registration.\nfunc isNomadAgent(id string) bool {\n\treturn isNomadClient(id) || isNomadServer(id)\n}","sourceCodeStart":2042,"sourceCodeEnd":2078,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/consul/service_client.go#L2042-L2078","documentation":"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.","triggerScenarios":"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.","commonSituations":"Typo in HCL check type; copying Consul-native check types Nomad doesn't accept; older Nomad version lacking a newer check type added later.","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."],"exampleFix":"// before\ncheck { type = \"https\", path = \"/health\" }\n// after\ncheck { type = \"http\", path = \"/health\", tls_skip_verify = true }","handlingStrategy":"validation","validationCode":"var validCheckTypes = map[string]bool{\"http\": true, \"tcp\": true, \"grpc\": true, \"script\": true, \"ttl\": true}\nif !validCheckTypes[strings.ToLower(check.Type)] {\n  return fmt.Errorf(\"unsupported check type %q\", check.Type)\n}","typeGuard":"func isValidCheckType(t string) bool {\n  switch t {\n  case \"http\", \"tcp\", \"grpc\", \"script\", \"ttl\":\n    return true\n  }\n  return false\n}","tryCatchPattern":"try {\n  nomad.jobRegister(job)\n} catch err {\n  if strings.Contains(err.Error(), \"not valid\") && strings.Contains(err.Error(), \"check type\") {\n    log.Error(\"fix check type in job spec\", \"err\", err)\n  }\n}","preventionTips":["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."],"tags":["consul","service-check","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}