{"record":{"id":"22078c58c9f3c6b1","repo":"hashicorp/nomad","slug":"success-before-passing-may-only-be-set-for-consul","errorCode":null,"errorMessage":"success_before_passing may only be set for Consul service checks","messagePattern":"success_before_passing may only be set for Consul service checks","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/services.go","lineNumber":390,"sourceCode":"\t\tif sc.CheckRestart.IgnoreWarnings {\n\t\t\treturn errors.New(\"ignore_warnings on check_restart only supported for Consul service checks\")\n\t\t}\n\t}\n\n\t// address_mode=\"driver\" not yet supported on nomad\n\tif sc.AddressMode == \"driver\" {\n\t\treturn errors.New(\"address_mode = driver may only be set for Consul service checks\")\n\t}\n\n\tif sc.Type == \"http\" {\n\t\tif sc.Method != \"\" && !helper.IsMethodHTTP(sc.Method) {\n\t\t\treturn fmt.Errorf(\"method type %q not supported in Nomad http check\", sc.Method)\n\t\t}\n\t}\n\n\t// success_before_passing is consul only\n\tif sc.SuccessBeforePassing != 0 {\n\t\treturn errors.New(\"success_before_passing may only be set for Consul service checks\")\n\t}\n\n\t// failures_before_critical is consul only\n\tif sc.FailuresBeforeCritical != 0 {\n\t\treturn errors.New(\"failures_before_critical may only be set for Consul service checks\")\n\t}\n\n\t// failures_before_warning is consul only\n\tif sc.FailuresBeforeWarning != 0 {\n\t\treturn errors.New(\"failures_before_warning may only be set for Consul service checks\")\n\t}\n\n\t// tls_server_name is consul only\n\tif sc.TLSServerName != \"\" {\n\t\treturn errors.New(\"tls_server_name may only be set for Consul service checks\")\n\t}\n\n\treturn nil","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/services.go#L372-L408","documentation":"Service check validation in validateNomad: success_before_passing was set to a non-zero value on a Nomad-native check; this Consul-only tuning field (delaying healthy status) is not supported for Nomad checks.","triggerScenarios":"Setting success_before_passing to a nonzero number on a check of a non-Consul service.","commonSituations":"Porting Consul health-check tuning to Nomad; flattening shared check templates across consul/nomad providers.","solutions":["Remove success_before_passing from the check","Move the service to provider = \"consul\" if the feature is required","Rely on interval/timeout tuning instead for nomad checks"],"exampleFix":"// before\ncheck {\n  success_before_passing = 3\n}\n// after\ncheck {\n  interval = \"10s\"\n  timeout  = \"2s\"\n}","handlingStrategy":"validation","validationCode":"if check.SuccessBeforePassing != 0 && service.Provider != \"consul\" {\n    return fmt.Errorf(\"check %q: success_before_passing requires consul provider\", check.Name)\n}","typeGuard":null,"tryCatchPattern":"if err := job.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"success_before_passing\") {\n        // remove the field or move service to consul\n    }\n}","preventionTips":["Keep consul-only pass/fail tuning out of nomad check stanzas","Split shared templates by provider","Run nomad job validate in CI"],"tags":["nomad","consul","service-check","validation"],"backgroundTag":"unsupported-check-option","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"}