hashicorp/nomad · error
Service provider must be %q, or %q; not %q
Error message
Service provider must be %q, or %q; not %q
What it means
This error is thrown by Service.Validate in nomad/structs/services.go when a service's `provider` field is neither "consul" nor "nomad". Nomad only supports these two service providers, so any other value fails validation before the job is submitted. It typically indicates a typo or an unsupported provider value in the service stanza.
Source
Thrown at nomad/structs/services.go:800
}
switch s.OnUpdate {
case "", OnUpdateIgnore, OnUpdateRequireHealthy, OnUpdateIgnoreWarn:
// OK
default:
mErr.Errors = append(mErr.Errors, fmt.Errorf("Service on_update must be %q, %q, or %q; not %q", OnUpdateRequireHealthy, OnUpdateIgnoreWarn, OnUpdateIgnore, s.OnUpdate))
}
// Up until this point, all service validation has been independent of the
// provider. From this point on, we have different validation paths. We can
// also catch an incorrect provider parameter.
switch s.Provider {
case ServiceProviderConsul:
s.validateConsulService(&mErr)
case ServiceProviderNomad:
s.validateNomadService(&mErr)
default:
mErr.Errors = append(mErr.Errors, fmt.Errorf("Service provider must be %q, or %q; not %q",
ServiceProviderConsul, ServiceProviderNomad, s.Provider))
}
if err := s.validateIdentity(); err != nil {
mErr.Errors = append(mErr.Errors, err)
}
return mErr.ErrorOrNil()
}
// MakeUniqueIdentityName returns a service identity name consisting of: task
// name, service name and service port label.
func (s *Service) MakeUniqueIdentityName() string {
prefix := ConsulServiceIdentityNamePrefix
if s.Provider == ServiceProviderNomad {
prefix = "nomad-service"
}
if s.TaskName != "" {View on GitHub (pinned to 482b49bf1a)
Solutions
- Set provider = "consul" in the service stanza to register with Consul.
- Set provider = "nomad" in the service stanza to use Nomad's native service discovery.
- Remove the provider field if you want the cluster default and verify the cluster's default via the provider allow/deny list in agent config.
Example fix
// before
service {
name = "web"
provider = "Consul"
}
// after
service {
name = "web"
provider = "consul"
} Defensive patterns
Strategy: validation
Validate before calling
func validProvider(p string) bool { return p == "consul" || p == "nomad" }
if !validProvider(svc.Provider) { return fmt.Errorf("provider %q must be consul or nomad", svc.Provider) } Prevention
- Always set provider explicitly to "consul" or "nomad" in service stanzas
- Use HCL constants/variables for provider names instead of free-text strings
- Run `nomad job validate` before submitting jobs in CI
When it happens
Trigger: Submitting a job whose service stanza sets provider to any string other than ServiceProviderConsul ("consul") or ServiceProviderNomad ("nomad") — e.g. provider = "consul1", "Consul" (case handled via enum constants), "", or a misspelled value.
Common situations: Typo in the provider field; copying configs from tools that use different provider names; leaving provider empty when the job/cluster expects an explicit provider; upgrading Nomad where the default provider semantics changed.
Related errors
- wait config is nil or empty
- missing datacenter for client registration
- default_identity_ttl must be greater than 0
- max_identity_ttl must be greater than 0
- max_identity_ttl must be greater than or equal to default_id
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/c425ea95ba17683c.
Report an issue: GitHub.