chenhg5/cc-connect · error

download: %w

Error message

download: %w

What it means

Wraps a failed client.Get in downloadToTemp while fetching the release binary: the HTTP request itself errored (DNS failure, connection refused, TLS problem, timeout). The download aborts before any body is read.

Source

Thrown at cmd/cc-connect/update.go:403

		return tmp.Name(), nil
	}
	return "", fmt.Errorf("binary not found in archive")
}

func downloadToTemp(url string) (string, error) {
	client := &http.Client{
		Timeout: 5 * time.Minute,
		CheckRedirect: func(req *http.Request, via []*http.Request) error {
			if len(via) >= 10 {
				return fmt.Errorf("too many redirects")
			}
			return nil
		},
	}

	resp, err := client.Get(url)
	if err != nil {
		return "", fmt.Errorf("download: %w", err)
	}
	defer resp.Body.Close()

	if resp.StatusCode != 200 {
		return "", fmt.Errorf("download returned HTTP %d", resp.StatusCode)
	}

	tmp, err := os.CreateTemp("", "cc-connect-update-*")
	if err != nil {
		return "", err
	}

	size, err := io.Copy(tmp, resp.Body)
	if err != nil {
		tmp.Close()
		os.Remove(tmp.Name())
		return "", fmt.Errorf("write: %w", err)
	}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Check network connectivity and DNS resolution to github.com
  2. Retry — transient network faults are the usual cause
  3. Use a proxy or manual download if GitHub is unreachable
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at cmd/cc-connect/update.go:403 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/2d52a3469686d374. Report an issue: GitHub.