hashicorp/nomad · error

address_mode = driver may only be set for Consul service che

Error message

address_mode = driver may only be set for Consul service checks

What it means

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.

Source

Thrown at nomad/structs/services.go:379

	// nomad checks do not have warnings
	if sc.OnUpdate == OnUpdateIgnoreWarn {
		return errors.New("on_update may only be set to ignore_warnings for Consul service checks")
	}

	// below are temporary limitations on checks in nomad
	// https://github.com/hashicorp/team-nomad/issues/354

	// check_restart.ignore_warnings is not a thing in Nomad (which has no warnings in checks)
	if sc.CheckRestart != nil {
		if sc.CheckRestart.IgnoreWarnings {
			return errors.New("ignore_warnings on check_restart only supported for Consul service checks")
		}
	}

	// address_mode="driver" not yet supported on nomad
	if sc.AddressMode == "driver" {
		return errors.New("address_mode = driver may only be set for Consul service checks")
	}

	if sc.Type == "http" {
		if sc.Method != "" && !helper.IsMethodHTTP(sc.Method) {
			return fmt.Errorf("method type %q not supported in Nomad http check", sc.Method)
		}
	}

	// success_before_passing is consul only
	if sc.SuccessBeforePassing != 0 {
		return errors.New("success_before_passing may only be set for Consul service checks")
	}

	// failures_before_critical is consul only
	if sc.FailuresBeforeCritical != 0 {
		return errors.New("failures_before_critical may only be set for Consul service checks")
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Remove or change address_mode to "host" (or "auto") on the check
  2. Advertise the address via the service block instead
  3. Use a Consul service provider if driver address_mode is needed

Example fix

// before
check {
  address_mode = "driver"
}
// after
check {
  address_mode = "host"
}
Defensive patterns

Strategy: validation

Validate before calling

if check.AddressMode == "driver" && service.Provider != "consul" {
    return fmt.Errorf("check %q: address_mode=driver requires consul provider", check.Name)
}

Try / catch

if err := job.Validate(); err != nil {
    if strings.Contains(err.Error(), "address_mode = driver") {
        // switch to address_mode = "host"
    }
}

Prevention

When it happens

Trigger: A check on a nomad-provider service sets address_mode = "driver".

Common situations: 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.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/b8bae810f66273db. Report an issue: GitHub.