JanDeDobbeleer/oh-my-posh · error

failed to download zip file: %s → %s

Error message

failed to download zip file: %s
→ %s

What it means

`getRemoteFile` performs the HTTP GET for the font archive and errors when the server responds with a non-200 status, wrapping `resp.Status` (e.g. "404 Not Found") and the requested `location`. It is the network-level failure of the font download step; read of the body is aborted before any zip validation happens.

Source

Thrown at src/cli/font/download.go:84

	contentType := httplib.DetectContentType(data)
	return contentType == "application/zip"
}

func getRemoteFile(location string, report func(fraction float64)) (data []byte, err error) {
	req, err := httplib.NewRequestWithContext(context.Background(), "GET", location, nil)
	if err != nil {
		return nil, err
	}

	resp, err := http.HTTPClient.Do(req)
	if err != nil {
		return
	}

	defer resp.Body.Close()

	if resp.StatusCode != httplib.StatusOK {
		return data, fmt.Errorf("failed to download zip file: %s\n→ %s", resp.Status, location)
	}

	reader := ui.NewReader(resp.Body, resp.ContentLength, report)

	data, err = io.ReadAll(reader)
	if err != nil {
		return
	}

	return
}

// Download keeps the old name for callers that need no progress reporting (see font.Apply, which
// runs under DSC with nothing drawing).
func Download(fontURL string) ([]byte, error) {
	return download(fontURL, nil)
}

View on GitHub (pinned to 0976794618)

Solutions

  1. Check `resp.Status` in the message: 404 → fix the URL/asset name; 403 → check rate limit/auth; 5xx → retry later
  2. Wait for GitHub API rate limit reset or authenticate requests if hitting api.github.com heavily
  3. Verify network/proxy connectivity (`curl -I <location>`)
  4. Retry the `oh-my-posh font` command after confirming the URL works in a browser
  5. Pin to a still-existing release tag if the font release was renamed/removed
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Head(url)
if err != nil || resp.StatusCode != http.StatusOK {
	// fail fast before invoking the installer
	log.Fatalf("URL not reachable: %v (status %v)", err, resp)
}

Try / catch

if err := installFont(name); err != nil {
	var netErr net.Error
	if errors.As(err, &netErr) || strings.Contains(err.Error(), "failed to download zip file") {
		time.Sleep(retryBackoff)
		return installFont(name) // bounded retry
	}
	return err
}

Prevention

When it happens

Trigger: `http.HTTPClient.Do` returned a response whose `StatusCode != httplib.StatusOK` inside `getRemoteFile`, called from `download`. Any 4xx/5xx — 404 (asset/repo renamed), 403 (rate limited or private repo), 5xx (server error).

Common situations: GitHub API rate limiting (403 with rate-limit headers); font release asset renamed after a Nerd Fonts release; offline or DNS-failing network; proxy requiring auth returning 407.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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