{"record":{"id":"03670d9220d0d50b","repo":"JanDeDobbeleer/oh-my-posh","slug":"failed-to-parse-nerd-fonts-release","errorCode":null,"errorMessage":"failed to parse nerd fonts release","messagePattern":"failed to parse nerd fonts release","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/font/fonts.go","lineNumber":130,"sourceCode":"\n\trepoURL := \"https://api.github.com/repos/\" + repo + \"/releases/latest\"\n\treq, err := httplib.NewRequestWithContext(ctx, \"GET\", repoURL, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Accept\", \"application/vnd.github.v3+json\")\n\tresponse, err := http.HTTPClient.Do(req)\n\tif err != nil || response.StatusCode != httplib.StatusOK {\n\t\treturn nil, fmt.Errorf(\"failed to get %s release\", repo)\n\t}\n\n\tdefer response.Body.Close()\n\n\tvar release release\n\terr = json.NewDecoder(response.Body).Decode(&release)\n\tif err != nil {\n\t\treturn nil, errors.New(\"failed to parse nerd fonts release\")\n\t}\n\n\tvar fonts []*Asset\n\tfor _, asset := range release.Assets {\n\t\tif asset.State == \"uploaded\" && strings.HasSuffix(asset.Name, \".zip\") {\n\t\t\tasset.Name = strings.TrimSuffix(asset.Name, \".zip\")\n\t\t\tfonts = append(fonts, asset)\n\t\t}\n\t}\n\n\treturn fonts, nil\n}\n","sourceCodeStart":112,"sourceCodeEnd":143,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/cli/font/fonts.go#L112-L143","documentation":"fetchFontAssets downloads the Nerd Fonts release metadata from the GitHub API and decodes the JSON body into the internal `release` struct. If the HTTP call succeeded but the body is not decodable as that JSON shape, the function discards the underlying decode error and returns this generic message.","triggerScenarios":"The GitHub API response body is HTML (rate-limit page, proxy error page), truncated, empty, or the release JSON schema changed so it no longer unmarshals into the `release` struct (e.g. `assets` no longer an array of objects with name/state).","commonSituations":"Unauthenticated GitHub API rate limiting returning a JSON error body that doesn't match the struct; corporate proxies intercepting TLS; GitHub incidents changing response shape; captive portals returning HTML.","solutions":["Check the raw response from https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest to see what is actually returned.","Authenticate GitHub API calls (token) to avoid rate-limit responses that break decoding.","Retry later if GitHub is having an incident; inspect network/proxy behavior for HTML injection.","As a workaround, download and install the Nerd Font zip manually via `oh-my-posh font install <url>`."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"resp, err := http.Get(\"https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest\")\nif err == nil {\n    ct := resp.Header.Get(\"Content-Type\")\n    if !strings.Contains(ct, \"application/json\") {\n        // response is HTML/intercepted; do not attempt decode\n    }\n}","typeGuard":null,"tryCatchPattern":"assets, err := font.NerdFonts(\"FiraCode\")\nif err != nil && strings.Contains(err.Error(), \"failed to parse\") {\n    // inspect api.github.com reachability / rate-limit state, then retry with backoff\n    time.Sleep(5 * time.Second)\n    assets, err = font.NerdFonts(\"FiraCode\")\n}","preventionTips":["Use authenticated GitHub API requests to avoid rate-limit and HTML error bodies","Add backoff+retry around font listing in automation","Verify corporate proxies aren't rewriting api.github.com responses"],"tags":["font","json","github-api","decode","network"],"backgroundTag":"json-decode-failed","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}