JanDeDobbeleer/oh-my-posh · error

failed to download asset: %s

Error message

failed to download asset: %s

What it means

During upgrade, the updater downloads a release asset over HTTP. If the response status is not 200 OK, the download is abandoned and this error is returned with the requested URL. The underlying request error path is separate (that one logs and returns the transport error directly).

Source

Thrown at src/cli/upgrade/config.go:108

func (cfg *Config) Download(url string) ([]byte, error) {
	req, err := httplib.NewRequestWithContext(context.Background(), "GET", url, nil)
	if err != nil {
		log.Debugf("failed to create request for url: %s", url)
		return nil, err
	}

	req.Header.Add("User-Agent", "oh-my-posh")
	req.Header.Add("Cache-Control", "max-age=0")

	resp, err := http.HTTPClient.Do(req)
	if err != nil {
		log.Debugf("failed to execute HTTP request: %s", url)
		return nil, err
	}

	if resp.StatusCode != httplib.StatusOK {
		return nil, fmt.Errorf("failed to download asset: %s", url)
	}

	defer resp.Body.Close()

	reader := &downloadProgressReader{reader: resp.Body, total: resp.ContentLength}

	data, err := io.ReadAll(reader)
	if err != nil {
		log.Debugf("failed to read response body: %s", url)
		return nil, err
	}

	return data, nil
}

View on GitHub (pinned to 0976794618)

Solutions

  1. Retry later — transient GitHub 5xx or rate-limit (403) usually clears
  2. Set a GITHUB_TOKEN so authenticated requests avoid the 60 req/h anonymous rate limit
  3. Verify the target release/version and asset name still exist on GitHub
  4. Check proxy/firewall settings if behind a corporate network
  5. Update oh-my-posh manually (installer script or package manager) if the self-updater is broken

Example fix

// before
oh-my-posh upgrade
// after (avoid rate limiting / flaky self-update)
GITHUB_TOKEN=ghp_xxx oh-my-posh upgrade
# or
winget upgrade JanDeDobbeleer.OhMyPosh
Defensive patterns

Strategy: retry

Validate before calling

// pre-check release availability
resp, _ := http.Head(assetURL)
if resp == nil || resp.StatusCode != 200 { /* abort or warn before invoking updater */ }

Try / catch

if err := cli.Upgrade(); err != nil {
    if strings.Contains(err.Error(), "failed to download asset") {
        // wait and retry with backoff; check GITHUB_TOKEN is set
    }
}

Prevention

When it happens

Trigger: Calling Download/DownloadAsset against a GitHub release asset URL that returns a non-200 status: 404 (asset/release missing), 403 (rate limit), 5xx (server error), or a proxy error page.

Common situations: GitHub API rate limiting without auth token; the release or asset name changed/removed; corporate proxy returning an error page; network appliance intercepting TLS.

Related errors


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