{"record":{"id":"4807189fc9f2e875","repo":"kubernetes/kops","slug":"unexpected-response-from-q-http-s","errorCode":null,"errorMessage":"unexpected response from %q: HTTP %s","messagePattern":"unexpected response from %q: HTTP (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/http.go","lineNumber":161,"sourceCode":"\n\tctx, cancel := context.WithTimeout(context.Background(), downloadTimeout)\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"cannot create request: %v\", err)\n\t}\n\n\tresponse, err := httpClient.Do(req)\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"error doing HTTP fetch of %q: %v\", url, err)\n\t}\n\n\t// http.Client follows 3xx automatically, so anything outside 2xx that reaches us is a bug or a missing Location.\n\tif response.StatusCode < 200 || response.StatusCode > 299 {\n\t\tresponse.Body.Close()\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"unexpected response from %q: HTTP %s\", url, response.Status)\n\t}\n\n\treturn &cancelOnCloseReadCloser{ReadCloser: response.Body, cancel: cancel}, nil\n}\n\nfunc newDownloadHTTPClient() *http.Client {\n\treturn &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t\tDialContext: (&net.Dialer{\n\t\t\t\tTimeout:   30 * time.Second,\n\t\t\t\tKeepAlive: 30 * time.Second,\n\t\t\t}).DialContext,\n\t\t\tTLSHandshakeTimeout:   10 * time.Second,\n\t\t\tResponseHeaderTimeout: 30 * time.Second,\n\t\t\tIdleConnTimeout:       30 * time.Second,\n\t\t},\n\t}","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/http.go#L143-L179","documentation":"Thrown by OpenURL when the server responded but with a status outside 2xx after redirects were followed automatically. Concretely: 404/410 mean the artifact is gone at that URL, 403 signals denied access, and 5xx is a server-side failure — the download is rejected rather than saving an error page as content.","triggerScenarios":"Thrown at upup/pkg/fi/http.go:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"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"}