{"record":{"id":"50d3402ca2129dd2","repo":"matryer/xbar","slug":"marshal","errorCode":null,"errorMessage":"marshal","messagePattern":"marshal","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/update/update.go","lineNumber":130,"sourceCode":"\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\n\t}\n\thasUpdate := hasUpdate(u.CurrentVersion, latest.TagName)\n\treturn latest, hasUpdate, nil\n}\n","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/pkg/update/update.go#L112-L148","documentation":"Raised in Updater.getLatestRelease when json.Unmarshal cannot decode the downloaded release response body into the Release struct — the endpoint returned HTML (e.g. a proxy or error page), a truncated document, or a JSON schema that does not match the struct. The bytes were read successfully but do not represent a valid release object.","triggerScenarios":"Thrown at pkg/update/update.go:130 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log or inspect the raw body to see what was actually returned (often an HTML error or auth page instead of JSON)","Verify the endpoint is the GitHub API releases URL, not an HTML page redirected by a proxy or captive portal","Check that the Release struct fields/tags match the current GitHub API response schema","Retry, as a truncated download can also produce invalid JSON"],"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"}