{"record":{"id":"b8bae810f66273db","repo":"hashicorp/nomad","slug":"address-mode-driver-may-only-be-set-for-consul-s","errorCode":null,"errorMessage":"address_mode = driver may only be set for Consul service checks","messagePattern":"address_mode = driver may only be set for Consul service checks","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/services.go","lineNumber":379,"sourceCode":"\n\t// nomad checks do not have warnings\n\tif sc.OnUpdate == OnUpdateIgnoreWarn {\n\t\treturn errors.New(\"on_update may only be set to ignore_warnings for Consul service checks\")\n\t}\n\n\t// below are temporary limitations on checks in nomad\n\t// https://github.com/hashicorp/team-nomad/issues/354\n\n\t// check_restart.ignore_warnings is not a thing in Nomad (which has no warnings in checks)\n\tif sc.CheckRestart != nil {\n\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","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/services.go#L361-L397","documentation":"Service check validation in structs validateNomad: the check sets address_mode = \"driver\", which resolves the address from the task driver, but that mode is only implemented for Consul service checks, not Nomad-native checks.","triggerScenarios":"A check on a nomad-provider service sets address_mode = \"driver\".","commonSituations":"Reusing a Consul check block verbatim on a nomad service; trying to resolve host/drive address ambiguity in nomad checks where the option is unsupported.","solutions":["Remove or change address_mode to \"host\" (or \"auto\") on the check","Advertise the address via the service block instead","Use a Consul service provider if driver address_mode is needed"],"exampleFix":"// before\ncheck {\n  address_mode = \"driver\"\n}\n// after\ncheck {\n  address_mode = \"host\"\n}","handlingStrategy":"validation","validationCode":"if check.AddressMode == \"driver\" && service.Provider != \"consul\" {\n    return fmt.Errorf(\"check %q: address_mode=driver requires consul provider\", check.Name)\n}","typeGuard":null,"tryCatchPattern":"if err := job.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"address_mode = driver\") {\n        // switch to address_mode = \"host\"\n    }\n}","preventionTips":["Use address_mode host/auto on nomad checks","Only set driver mode for Consul checks","Validate job HCL before submit"],"tags":["nomad","consul","address-mode","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"}