hashicorp/nomad · error
config HTTP Client must be set
Error message
config HTTP Client must be set
What it means
Guard error in ConfigureTLS: TLS configuration was supplied but the *http.Client is nil, so TLS settings cannot be applied to any transport. The input at fault is a nil httpClient paired with a non-nil tlsConfig.
Source
Thrown at api/api.go:451
// apply timeout
ntr.DialContext = (&net.Dialer{
Timeout: t,
KeepAlive: 30 * time.Second,
}).DialContext
// clone http client with new transport
nc := *httpClient
nc.Transport = ntr
return &nc, nil
}
// ConfigureTLS applies a set of TLS configurations to the HTTP client.
func ConfigureTLS(httpClient *http.Client, tlsConfig *TLSConfig) error {
if tlsConfig == nil {
return nil
}
if httpClient == nil {
return errors.New("config HTTP Client must be set")
}
var clientCert tls.Certificate
foundClientCert := false
if tlsConfig.ClientCert != "" || tlsConfig.ClientKey != "" {
if tlsConfig.ClientCert != "" && tlsConfig.ClientKey != "" {
var err error
clientCert, err = tls.LoadX509KeyPair(tlsConfig.ClientCert, tlsConfig.ClientKey)
if err != nil {
return err
}
foundClientCert = true
} else {
return errors.New("Both client cert and client key must be provided")
}
} else if len(tlsConfig.ClientCertPEM) != 0 || len(tlsConfig.ClientKeyPEM) != 0 {
if len(tlsConfig.ClientCertPEM) != 0 && len(tlsConfig.ClientKeyPEM) != 0 {
var err errorView on GitHub (pinned to 482b49bf1a)
Solutions
- Initialize Config.HTTPClient with a valid *http.Client before calling ConfigureTLS/NewClient
- Skip ConfigureTLS when no TLS config is needed (nil tlsConfig is allowed)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at api/api.go:451 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/b50ea08c984d7f2e.
Report an issue: GitHub.