{"record":{"id":"7783ca24b16078ea","repo":"matryer/xbar","slug":"read-body","errorCode":null,"errorMessage":"read body","messagePattern":"read body","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/update/update.go","lineNumber":125,"sourceCode":"\ttime.Sleep(1 * time.Second)\n\tlog.Println(\"terminating after update.\")\n\tos.Exit(0)\n\treturn nil\n}\n\n// getLatestRelease gets the latest release.\nfunc (u *Updater) getLatestRelease() (*Release, error) {\n\tresp, err := u.Client.Get(u.LatestReleaseGitHubEndpoint)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"get latest release\")\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, errors.Errorf(\"failed to check for updates: got %s\", resp.Status)\n\t}\n\tb, err := io.ReadAll(io.LimitReader(resp.Body, u.DownloadBytesLimit))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"read body\")\n\t}\n\tvar latestRelease Release\n\terr = json.Unmarshal(b, &latestRelease)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"marshal\")\n\t}\n\tlatestRelease.CreatedAt, err = time.Parse(time.RFC3339Nano, latestRelease.CreatedAtString)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"time.Parse: created_at\")\n\t}\n\treturn &latestRelease, nil\n}\n\n// HasUpdate checks whether there's an update or not.\nfunc (u *Updater) HasUpdate() (*Release, bool, error) {\n\tlatest, err := u.getLatestRelease()\n\tif err != nil {\n\t\treturn nil, false, err","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/pkg/update/update.go#L107-L143","documentation":"Raised in Updater.getLatestRelease when io.ReadAll fails while reading the (size-limited) response body of the GitHub releases response — the connection dropped or was reset mid-body. Without the full body, the release JSON cannot be parsed and update detection fails.","triggerScenarios":"Thrown at pkg/update/update.go:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the HTTP request, since interrupted connections are usually transient","Check that DownloadBytesLimit is not set so low it truncates and breaks the read","Verify network stability (proxies, VPNs, flaky Wi-Fi can reset connections mid-transfer)","Increase any client-side or proxy timeouts that might abort long reads"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d624239058997c80118eaebe2e7f8331b3c765e0","analyzedAt":"2026-09-02T22:38:22.007Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}