{"record":{"id":"ac0fd8bb97726138","repo":"kubernetes/kops","slug":"building-http-client-w","errorCode":null,"errorMessage":"building http client: %w","messagePattern":"building http client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/util/factory.go","lineNumber":216,"sourceCode":"}\n\nfunc configureRESTConfig(restConfig *rest.Config) {\n\trestConfig.UserAgent = \"kops\"\n\trestConfig.Burst = 50\n\trestConfig.QPS = 20\n\trestConfig.AcceptContentTypes = runtime.ContentTypeProtobuf\n\trestConfig.ContentType = runtime.ContentTypeProtobuf\n}\n\nfunc (f *Factory) HTTPClient(restConfig *rest.Config) (*http.Client, error) {\n\treturn rest.HTTPClientFor(restConfig)\n}\n\nfunc (f *clusterInfo) HTTPClient(restConfig *rest.Config) (*http.Client, error) {\n\tif f.cachedHTTPClient == nil {\n\t\thttpClient, err := rest.HTTPClientFor(restConfig)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"building http client: %w\", err)\n\t\t}\n\t\tf.cachedHTTPClient = httpClient\n\t}\n\treturn f.cachedHTTPClient, nil\n}\n\n// DynamicClient returns a dynamic client\nfunc (f *Factory) DynamicClient(ctx context.Context, cluster *kops.Cluster, options kubeconfig.CreateKubecfgOptions) (dynamic.Interface, error) {\n\tclusterInfo := f.getClusterInfo(cluster, options)\n\trestConfig, err := clusterInfo.RESTConfig(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn clusterInfo.DynamicClient(restConfig)\n}\n\nfunc (f *clusterInfo) DynamicClient(restConfig *rest.Config) (dynamic.Interface, error) {\n\tif f.cachedDynamicClient == nil {","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/util/factory.go#L198-L234","documentation":"Wraps a failure of rest.HTTPClientFor in clusterInfo.HTTPClient: an *http.Client could not be built from the REST config, typically because a custom transport/TLS/auth option in the kubeconfig is invalid. The dynamic-client construction path fails before any request is sent.","triggerScenarios":"Thrown at cmd/kops/util/factory.go:216 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check proxy and TLS settings in kubeconfig","Remove unsupported exec/auth-plugin config","Regenerate kubeconfig with kops export kubecfg"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}