{"record":{"id":"2bb70a91cacc5d8e","repo":"matryer/xbar","slug":"download-asset","errorCode":null,"errorMessage":"download asset","messagePattern":"download asset","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/update/update.go","lineNumber":190,"sourceCode":"\t\t// semver failed - just check tags\n\t\tif latest == current {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nfunc (u *Updater) downloadAndReplaceApp(asset Asset) error {\n\tfilename := path.Base(asset.BrowserDownloadURL)\n\tswitch {\n\tcase strings.HasSuffix(filename, \".zip\"):\n\t\t// fine\n\tdefault:\n\t\treturn errors.Errorf(\"file not supported: %s\", filename)\n\t}\n\tresp, err := u.Client.Get(asset.BrowserDownloadURL)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"download asset\")\n\t}\n\tdefer resp.Body.Close()\n\tconst defaultTempDir = \"\"\n\tf, err := os.CreateTemp(defaultTempDir, \"*-\"+filename)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"create temp file\")\n\t}\n\t_, err = io.Copy(f, io.LimitReader(resp.Body, u.DownloadBytesLimit))\n\tif err != nil {\n\t\tf.Close()\n\t\treturn errors.Wrap(err, \"download asset\")\n\t}\n\tf.Close()\n\texecutable, err := u.GetExecutable()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"get executable\")\n\t}\n\tappPath, err := appPathFromExecutable(executable)","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/pkg/update/update.go#L172-L208","documentation":"The HTTP GET of the release asset failed at the transport level; the underlying error is wrapped as 'download asset'. This happens before any bytes are read, when u.Client.Get cannot complete the request (DNS failure, connection refused, TLS error, invalid URL, etc.).","triggerScenarios":"Calling Update() when the asset's BrowserDownloadURL is unreachable or malformed, or the custom u.Client fails the request.","commonSituations":"Offline machine or restrictive firewall; GitHub redirects to objects.githubusercontent.com blocked by a proxy; asset URL points to a deleted release; custom http.Client with a bad proxy configuration.","solutions":["Check network connectivity and that the asset URL is reachable (curl -I the BrowserDownloadURL).","Inspect the wrapped underlying error for DNS/proxy/TLS specifics and fix the client or proxy config.","Ensure the release/asset still exists and the URL is not stale after deleting and re-publishing a release.","Add retry logic with backoff for transient network failures."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"resp, err := http.Head(asset.BrowserDownloadURL)\nif err != nil || resp.StatusCode != http.StatusOK {\n\treturn fmt.Errorf(\"asset URL not reachable: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"err := u.Update()\nif err != nil && strings.Contains(err.Error(), \"download asset\") {\n\ttime.Sleep(2 * time.Second)\n\terr = u.Update() // retry once on transient network failure\n}","preventionTips":["Configure u.Client with sane timeouts and a working proxy","Verify asset URLs are reachable with curl before releases","Add automatic retry with backoff around Update()"],"tags":["network","http","download"],"backgroundTag":"http-request-failed","analyzedSha":"d624239058997c80118eaebe2e7f8331b3c765e0","analyzedAt":"2026-09-02T22:38:22.007Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}