{"record":{"id":"940673fc4dcc11af","repo":"hashicorp/nomad","slug":"nil-http-client-transport","errorCode":null,"errorMessage":"nil HTTP client transport","messagePattern":"nil HTTP client transport","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/api.go","lineNumber":400,"sourceCode":"\t}\n\tif v := os.Getenv(\"NOMAD_SKIP_VERIFY\"); v != \"\" {\n\t\tif insecure, err := strconv.ParseBool(v); err == nil {\n\t\t\tconfig.TLSConfig.Insecure = insecure\n\t\t}\n\t}\n\tif v := os.Getenv(\"NOMAD_TOKEN\"); v != \"\" {\n\t\tconfig.SecretID = v\n\t}\n\treturn config\n}\n\n// cloneWithTimeout returns a cloned httpClient with set timeout if positive;\n// otherwise, returns the same client\nfunc cloneWithTimeout(httpClient *http.Client, t time.Duration) (*http.Client, error) {\n\tif httpClient == nil {\n\t\treturn nil, errors.New(\"nil HTTP client\")\n\t} else if httpClient.Transport == nil {\n\t\treturn nil, errors.New(\"nil HTTP client transport\")\n\t}\n\n\tif t.Nanoseconds() < 0 {\n\t\treturn httpClient, nil\n\t}\n\n\ttr, ok := httpClient.Transport.(*http.Transport)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected HTTP transport: %T\", httpClient.Transport)\n\t}\n\n\t// copy all public fields, to avoid copying transient state and locks\n\tntr := &http.Transport{\n\t\tProxy:                  tr.Proxy,\n\t\tDialContext:            tr.DialContext,\n\t\tDial:                   tr.Dial,\n\t\tDialTLS:                tr.DialTLS,\n\t\tTLSClientConfig:        tr.TLSClientConfig,","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/api/api.go#L382-L418","documentation":"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.","triggerScenarios":"Thrown at api/api.go:400 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}