kubernetes/kops · error

unexpected response from %q: HTTP %s

Error message

unexpected response from %q: HTTP %s

What it means

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.

Source

Thrown at upup/pkg/fi/http.go:161

	ctx, cancel := context.WithTimeout(context.Background(), downloadTimeout)
	req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
	if err != nil {
		cancel()
		return nil, fmt.Errorf("cannot create request: %v", err)
	}

	response, err := httpClient.Do(req)
	if err != nil {
		cancel()
		return nil, fmt.Errorf("error doing HTTP fetch of %q: %v", url, err)
	}

	// http.Client follows 3xx automatically, so anything outside 2xx that reaches us is a bug or a missing Location.
	if response.StatusCode < 200 || response.StatusCode > 299 {
		response.Body.Close()
		cancel()
		return nil, fmt.Errorf("unexpected response from %q: HTTP %s", url, response.Status)
	}

	return &cancelOnCloseReadCloser{ReadCloser: response.Body, cancel: cancel}, nil
}

func newDownloadHTTPClient() *http.Client {
	return &http.Client{
		Transport: &http.Transport{
			Proxy: http.ProxyFromEnvironment,
			DialContext: (&net.Dialer{
				Timeout:   30 * time.Second,
				KeepAlive: 30 * time.Second,
			}).DialContext,
			TLSHandshakeTimeout:   10 * time.Second,
			ResponseHeaderTimeout: 30 * time.Second,
			IdleConnTimeout:       30 * time.Second,
		},
	}

View on GitHub (pinned to 4c8573c808)

When it happens

Trigger: Thrown at upup/pkg/fi/http.go:161 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/4807189fc9f2e875. Report an issue: GitHub.