{"record":{"id":"52174e81929adbd3","repo":"kovidgoyal/kitty","slug":"failed-to-download-s-with-error-w","errorCode":null,"errorMessage":"Failed to download %s with error: %w","messagePattern":"Failed to download (.+?) with error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tools/themes/collection.go","lineNumber":390,"sourceCode":"\t\t\t\tif time.Now().Before(cache_age.Add(max_cache_age)) {\n\t\t\t\t\treturn cache_path, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif max_cache_age < 0 {\n\t\treturn \"\", ErrNoCacheFound\n\t}\n\treq, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif jm.Etag != \"\" {\n\t\treq.Header.Add(\"If-None-Match\", jm.Etag)\n\t}\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to download %s with error: %w\", url, err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\tif resp.StatusCode == http.StatusNotModified {\n\t\t\tjm.Timestamp = utils.ISO8601Format(time.Now())\n\t\t\tcomment, _ := json.Marshal(jm)\n\t\t\terr = set_comment_in_zip_file(cache_path, utils.UnsafeBytesToString(comment))\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\treturn cache_path, nil\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"Failed to download %s with HTTP error: %s\", url, resp.Status)\n\t}\n\tvar tf, tf2 *os.File\n\ttf, err = os.CreateTemp(filepath.Dir(cache_path), name+\".temp-*\")\n\tif err == nil {\n\t\ttf2, err = os.CreateTemp(filepath.Dir(cache_path), name+\".temp-*\")","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/tools/themes/collection.go#L372-L408","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running kitten themes fetch behind restrictive networks/corporate proxies, transient internet outages, or a mistyped/customized collection URL.","solutions":["Check network connectivity and DNS resolution for the URL in the message","Set HTTPS_PROXY/HTTP_PROXY if behind a corporate proxy, or fix firewall rules","Retry after the transient outage; the cached copy (if any) remains usable","If using a custom URL, verify it is reachable with curl"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"resp, err := http.Head(url)\nif err != nil || resp.StatusCode >= 400 { use local cache; skip refresh }","typeGuard":null,"tryCatchPattern":"if _, err := collection.FetchCached(); err != nil { log.Printf(\"theme fetch failed (offline?): %v\", err); fall back to bundled themes }","preventionTips":["Configure HTTPS_PROXY in proxied environments","Cache theme collections locally and tolerate fetch failures gracefully"],"tags":["network","http","download","kitty","themes"],"backgroundTag":"http-request-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}