{"record":{"id":"b1a217907bb943e6","repo":"hashicorp/nomad","slug":"check-s-invalid-v","errorCode":null,"errorMessage":"Check %s invalid: %v","messagePattern":"Check (.+?) invalid: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/services.go","lineNumber":871,"sourceCode":"\t// check checks\n\tfor _, c := range s.Checks {\n\t\t// validate the check port\n\t\tif err := s.validateCheckPort(c); err != nil {\n\t\t\tmErr.Errors = append(mErr.Errors, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// TCP checks against a Consul Connect enabled service are not supported\n\t\t// due to the service being bound to the loopback interface inside the\n\t\t// network namespace\n\t\tif c.Type == ServiceCheckTCP && s.Connect != nil && s.Connect.SidecarService != nil {\n\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"Check %s invalid: tcp checks are not valid for Connect enabled services\", c.Name))\n\t\t\tcontinue\n\t\t}\n\n\t\t// validate the consul check\n\t\tif err := c.validateConsul(); err != nil {\n\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"Check %s invalid: %v\", c.Name, err))\n\t\t}\n\t}\n\n\t// validate the consul service kind\n\tswitch api.ServiceKind(s.Kind) {\n\tcase api.ServiceKindTypical,\n\t\tapi.ServiceKindAPIGateway,\n\t\tapi.ServiceKindIngressGateway,\n\t\tapi.ServiceKindMeshGateway,\n\t\tapi.ServiceKindTerminatingGateway:\n\tdefault:\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"Service %s kind must be one of consul service kind or empty\", s.Name))\n\t}\n\n\t// check connect\n\tif s.Connect != nil {\n\t\tif err := s.Connect.Validate(); err != nil {\n\t\t\tmErr.Errors = append(mErr.Errors, err)","sourceCodeStart":853,"sourceCodeEnd":889,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/services.go#L853-L889","documentation":"This is the wrapper error format used in validateConsulService when ServiceCheck.validateConsul() returns an error for a check on a Consul-provider service. The %s is the check name and %v the underlying reason (bad interval, timeout, method, header, grpc address, etc.). The check-level failure is nested inside this message.","triggerScenarios":"Any check validation failure for a consul-provider service, e.g. interval/timeout below minimums, unsupported check type, invalid expose config, or a grpc check without address_mode constraints.","commonSituations":"Misconfigured check timings (too-short intervals), using http checks with invalid paths, or checks referencing fields only valid for other providers.","solutions":["Read the nested %v detail for the specific check violation and fix it in the check stanza.","Ensure interval and timeout meet Consul's minimum durations (e.g. interval >= 1s).","Verify check type is one of tcp, http, grpc, or script (with appropriate permissions)."],"exampleFix":"// before\ncheck {\n  type = \"http\"\n  interval = \"100ms\"\n  timeout = \"1s\"\n}\n// after\ncheck {\n  type = \"http\"\n  interval = \"10s\"\n  timeout = \"2s\"\n}","handlingStrategy":"validation","validationCode":"if c.Interval != \"\" {\n  if d, err := time.ParseDuration(c.Interval); err != nil || d < time.Second {\n    return fmt.Errorf(\"check %q: interval must be >= 1s\", c.Name)\n  }\n}","typeGuard":null,"tryCatchPattern":"err := job.Validate()\nvar me *structs.MultiError\nif errors.As(err, &me) {\n  for _, e := range me.Errors {\n    if strings.Contains(e.Error(), \"Check \") {\n      log.Printf(\"fix service check: %v\", e)\n    }\n  }\n}","preventionTips":["Keep check intervals >= 1s and timeouts shorter than intervals","Only use fields supported by the chosen provider (consul vs nomad checks differ)","Validate jobs with `nomad job validate` before submission"],"tags":["nomad","consul","service-check","validation"],"backgroundTag":"service-check-validation-failed","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"}