kovidgoyal/kitty · error

Failed to download with error

Error message

Failed to download %s with error: %w

What it means

fetch_cached performs an HTTP GET for a theme collection JSON; any transport-level failure from http.DefaultClient.Do (DNS, timeout, refused connection, TLS) is wrapped with the failing URL.

Solutions

  1. Check network connectivity and DNS resolution for the URL in the message
  2. Set HTTPS_PROXY/HTTP_PROXY if behind a corporate proxy, or fix firewall rules
  3. Retry after the transient outage; the cached copy (if any) remains usable
  4. If using a custom URL, verify it is reachable with curl
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Head(url)
if err != nil || resp.StatusCode >= 400 { use local cache; skip refresh }

Try / catch

if _, err := collection.FetchCached(); err != nil { log.Printf("theme fetch failed (offline?): %v", err); fall back to bundled themes }

Prevention

When it happens

Trigger: Fetching a theme collection when the machine is offline, DNS for the kitty themes host fails, a proxy blocks the request, or the request times out.

Common situations: Running kitten themes fetch behind restrictive networks/corporate proxies, transient internet outages, or a mistyped/customized collection URL.

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


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/52174e81929adbd3. Report an issue: GitHub.

Appendix: source

Thrown at tools/themes/collection.go:390

				if time.Now().Before(cache_age.Add(max_cache_age)) {
					return cache_path, nil
				}
			}
		}
	}
	if max_cache_age < 0 {
		return "", ErrNoCacheFound
	}
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		return "", err
	}
	if jm.Etag != "" {
		req.Header.Add("If-None-Match", jm.Etag)
	}
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		return "", fmt.Errorf("Failed to download %s with error: %w", url, err)
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		if resp.StatusCode == http.StatusNotModified {
			jm.Timestamp = utils.ISO8601Format(time.Now())
			comment, _ := json.Marshal(jm)
			err = set_comment_in_zip_file(cache_path, utils.UnsafeBytesToString(comment))
			if err != nil {
				return "", err
			}
			return cache_path, nil
		}
		return "", fmt.Errorf("Failed to download %s with HTTP error: %s", url, resp.Status)
	}
	var tf, tf2 *os.File
	tf, err = os.CreateTemp(filepath.Dir(cache_path), name+".temp-*")
	if err == nil {
		tf2, err = os.CreateTemp(filepath.Dir(cache_path), name+".temp-*")

View on GitHub (pinned to 6d5d0c4406)