urfave/cli · error

download file from %[2]s into %[3]s: response %[1]v

Error message

download file from %[2]s into %[3]s: response %[1]v

What it means

This build-script helper (scripts/build.go, downloadFile used by EnsureGfmrunActionFunc) downloads a file (e.g. the gfmrun binary) via HTTP GET and errors when the response status code is 300 or greater. The error names the source URL, the destination path, and the received status code.

Source

Thrown at scripts/build.go:212

	fmt.Fprintf(os.Stderr, "# ---> %s\n", cmd)
	return cmd.Run()
}

func downloadFile(src, dest string, dirPerm, perm os.FileMode) error {
	req, err := http.NewRequest(http.MethodGet, src, nil)
	if err != nil {
		return err
	}

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

	defer resp.Body.Close()

	if resp.StatusCode >= 300 {
		return fmt.Errorf("download file from %[2]s into %[3]s: response %[1]v", resp.StatusCode, src, dest)
	}

	if err := os.MkdirAll(filepath.Dir(dest), dirPerm); err != nil {
		return err
	}

	out, err := os.Create(dest)
	if err != nil {
		return err
	}

	if _, err := io.Copy(out, resp.Body); err != nil {
		return err
	}

	if err := out.Close(); err != nil {
		return err
	}

View on GitHub (pinned to 1a4deb4f5a)

Solutions

  1. Check the reported status code: for 404, update the pinned version/URL in the build script to an existing release asset.
  2. For 403 rate limits, add a GITHUB_TOKEN to the request or wait for the rate-limit window to reset.
  3. For 5xx/3xx, retry later or verify the URL manually with curl -I; if redirects are being mishandled, use the final asset URL directly.
  4. Run behind the corporate proxy: set HTTPS_PROXY so the request reaches the host correctly.

Example fix

// before (pinned URL 404s)
https://github.com/owner/gfmrun/releases/download/v1.2.9/gfmrun

// after
https://github.com/owner/gfmrun/releases/download/v1.4.0/gfmrun
Defensive patterns

Strategy: retry

Validate before calling

// check the URL is reachable and returns 2xx before the build step
curl -fsSL -o /dev/null -w '%{http_code}' "$GFMRUN_URL" | grep -q '^2' \
  || { echo "gfmrun asset unavailable: $GFMRUN_URL" >&2; exit 1; }

Try / catch

for i in 1 2 3; do
  if downloadFile "$src" "$dest" 0o755 0o644; then break; fi
  echo "download attempt $i failed; retrying in 5s"; sleep 5
done

Prevention

When it happens

Trigger: The URL passed as src returns a redirect chain that is not followed to a 2xx (e.g. bare 3xx without Location), a 404 because the requested version/tag of the asset no longer exists, a 403 from rate limiting (GitHub API limits), or a 5xx from the host.

Common situations: CI jobs pinning an outdated gfmrun version whose release asset was removed; GitHub rate-limit 403s on unauthenticated requests from shared CI IPs; network proxies returning 407/502; typos in the release URL.

Related errors


AI-assisted analysis of urfave/cli@1a4deb4f5a (2026-08-31). Data as JSON: /api/errors/febed3bd1073e3e7. Report an issue: GitHub.