JanDeDobbeleer/oh-my-posh · error

failed to parse nerd fonts release

Error message

failed to parse nerd fonts release

What it means

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.

Source

Thrown at src/cli/font/fonts.go:130

	repoURL := "https://api.github.com/repos/" + repo + "/releases/latest"
	req, err := httplib.NewRequestWithContext(ctx, "GET", repoURL, nil)
	if err != nil {
		return nil, err
	}

	req.Header.Add("Accept", "application/vnd.github.v3+json")
	response, err := http.HTTPClient.Do(req)
	if err != nil || response.StatusCode != httplib.StatusOK {
		return nil, fmt.Errorf("failed to get %s release", repo)
	}

	defer response.Body.Close()

	var release release
	err = json.NewDecoder(response.Body).Decode(&release)
	if err != nil {
		return nil, errors.New("failed to parse nerd fonts release")
	}

	var fonts []*Asset
	for _, asset := range release.Assets {
		if asset.State == "uploaded" && strings.HasSuffix(asset.Name, ".zip") {
			asset.Name = strings.TrimSuffix(asset.Name, ".zip")
			fonts = append(fonts, asset)
		}
	}

	return fonts, nil
}

View on GitHub (pinned to 0976794618)

Solutions

  1. Check the raw response from https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest to see what is actually returned.
  2. Authenticate GitHub API calls (token) to avoid rate-limit responses that break decoding.
  3. Retry later if GitHub is having an incident; inspect network/proxy behavior for HTML injection.
  4. As a workaround, download and install the Nerd Font zip manually via `oh-my-posh font install <url>`.
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Get("https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest")
if err == nil {
    ct := resp.Header.Get("Content-Type")
    if !strings.Contains(ct, "application/json") {
        // response is HTML/intercepted; do not attempt decode
    }
}

Try / catch

assets, err := font.NerdFonts("FiraCode")
if err != nil && strings.Contains(err.Error(), "failed to parse") {
    // inspect api.github.com reachability / rate-limit state, then retry with backoff
    time.Sleep(5 * time.Second)
    assets, err = font.NerdFonts("FiraCode")
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Related errors


AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31). Data as JSON: /api/errors/03670d9220d0d50b. Report an issue: GitHub.