hashicorp/nomad · error
nil HTTP client transport
Error message
nil HTTP client transport
What it means
Guard error in cloneWithTimeout: fires when the supplied *http.Client has a nil Transport, so the function cannot clone the transport to apply dial timeouts. Typically the client was hand-built without an explicit Transport.
Source
Thrown at api/api.go:400
}
if v := os.Getenv("NOMAD_SKIP_VERIFY"); v != "" {
if insecure, err := strconv.ParseBool(v); err == nil {
config.TLSConfig.Insecure = insecure
}
}
if v := os.Getenv("NOMAD_TOKEN"); v != "" {
config.SecretID = v
}
return config
}
// cloneWithTimeout returns a cloned httpClient with set timeout if positive;
// otherwise, returns the same client
func cloneWithTimeout(httpClient *http.Client, t time.Duration) (*http.Client, error) {
if httpClient == nil {
return nil, errors.New("nil HTTP client")
} else if httpClient.Transport == nil {
return nil, errors.New("nil HTTP client transport")
}
if t.Nanoseconds() < 0 {
return httpClient, nil
}
tr, ok := httpClient.Transport.(*http.Transport)
if !ok {
return nil, fmt.Errorf("unexpected HTTP transport: %T", httpClient.Transport)
}
// copy all public fields, to avoid copying transient state and locks
ntr := &http.Transport{
Proxy: tr.Proxy,
DialContext: tr.DialContext,
Dial: tr.Dial,
DialTLS: tr.DialTLS,
TLSClientConfig: tr.TLSClientConfig,View on GitHub (pinned to 482b49bf1a)
Solutions
- Set an explicit Transport (e.g. &http.Transport{}) on the http.Client passed in Config.HTTPClient
- Use api.DefaultConfig() which sets a proper transport
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at api/api.go:400 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/940673fc4dcc11af.
Report an issue: GitHub.