kubernetes/kops · error
downloading %q: %w
Error message
downloading %q: %w
What it means
In generatefileassets (a code-generation tool that turns remote SHA256SUMS files into embedded YAML manifests), run() fetches the hash file with http.Get. This error wraps any transport-level failure: DNS resolution, TCP connect, TLS, timeouts, or an invalid URL scheme. It does not cover HTTP error statuses (see 806).
Source
Thrown at pkg/assets/assetdata/tools/cmd/generatefileassets/main.go:58
filestoreBase := ""
prefix := ""
hashFileURL := ""
var exclude globList
flag.StringVar(&filestoreBase, "base", filestoreBase, "base directory")
flag.StringVar(&prefix, "prefix", prefix, "prefix to fetch")
flag.StringVar(&hashFileURL, "sums", hashFileURL, "prefix to fetch")
flag.Var(&exclude, "exclude", "path-globs to exclude from output")
flag.Parse()
if hashFileURL == "" {
hashFileURL = filestoreBase + prefix + "SHA256SUMS"
}
httpResponse, err := http.Get(hashFileURL)
if err != nil {
return fmt.Errorf("downloading %q: %w", hashFileURL, err)
}
if httpResponse.StatusCode != 200 {
return fmt.Errorf("unexpected status getting %q: %v", hashFileURL, httpResponse.Status)
}
defer httpResponse.Body.Close()
b, err := io.ReadAll(httpResponse.Body)
if err != nil {
return fmt.Errorf("reading body %q: %w", hashFileURL, err)
}
m := &manifest{}
for _, line := range strings.Split(string(b), "\n") {
line = strings.TrimSpace(line)
if line == "" {
continue
}
if line == "-----BEGIN PGP SIGNED MESSAGE-----" {View on GitHub (pinned to 4c8573c808)
Solutions
- Verify the URL (curl the hashFileURL printed in the error) and fix -base/-prefix/-sums flags
- Include the scheme in -sums, e.g. -sums https://storage.googleapis.com/.../SHA256SUMS
- Check network/proxy: set HTTPS_PROXY or run from a machine with internet access
- Retry if transient (DNS blip, rate limit); the tool does no retries itself
Example fix
// before main -base storage.googleapis.com/kops-ci/bin/ -prefix 1.28.0/ // after (note scheme) main -base https://storage.googleapis.com/kops-ci/bin/ -prefix 1.28.0/
Defensive patterns
Strategy: retry
Validate before calling
u, err := url.Parse(hashFileURL)
if err != nil || (u.Scheme != "http" && u.Scheme != "https") || u.Host == "" {
return fmt.Errorf("invalid hash file URL: %q", hashFileURL)
} Try / catch
resp, err := http.Get(hashFileURL)
if err != nil {
var netErr net.Error
if errors.As(err, &netErr) && netErr.Timeout() {
// retry with backoff
}
return fmt.Errorf("downloading %q: %w", hashFileURL, err)
} Prevention
- Always include an explicit http(s) scheme in -base/-sums
- Curl the URL before running the generator in CI
- Configure HTTPS_PROXY in restricted networks
- Add retry-with-backoff around generator invocations
When it happens
Trigger: Running the tool with a -base/-prefix/-sums combination producing a URL that fails http.Get — unreachable host, no network, DNS failure, offline CI, or malformed URL (e.g. missing scheme when -sums is given a bare hostname).
Common situations: CI runner without internet access; typo'd or stale filestore base; corporate proxy/firewall blocking storage.googleapis.com; passing -sums without http(s):// prefix.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- error reading tag file %q: %v
- droplet metadata returned non-200 status code: %d
- fetching metadata from '%s' returned status code '%d'
- error fetching %q: %v
- error reading response for %q: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/12b7965b1a6663f3.
Report an issue: GitHub.