abiosoft/colima · error

curl download failed for '%s': %w

Error message

curl download failed for '%s': %w

What it means

The curl subprocess exited non-zero while downloading the URL; %w carries the *exec.ExitError. Because the args include -fSL and -C -, the interesting exit codes are: 22 (HTTP >= 400), 6/7 (DNS/connect), 60 (TLS certificate problem, common with intercepting proxies), and 33 — the server ignored the Range header, so resuming an existing partial file at destPath failed.

Source

Thrown at util/downloader/curl.go:58

	// check if curl is available
	if _, err := exec.LookPath("curl"); err != nil {
		return fmt.Errorf("curl not found in PATH: %w", err)
	}

	args := []string{
		"-fSL",    // fail on HTTP errors, show errors, follow redirects
		"-C", "-", // resume if possible (auto-detect offset)
		"--progress-bar", // show progress bar
		"-o", destPath,   // output file
		r.URL,
	}

	cmd := exec.Command("curl", args...)
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr

	if err := cmd.Run(); err != nil {
		return fmt.Errorf("curl download failed for '%s': %w", path.Base(r.URL), err)
	}

	terminal.ClearLine()
	return nil
}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Reproduce with identical flags to read curl's real error: curl -fSL -C - --progress-bar -o <dest> <URL>
  2. If the exit is 33 (resume unsupported), delete the partial destPath file and download fresh
  3. For 404/410, verify the artifact URL still exists upstream and update it
  4. For TLS errors (60), install the proxy's CA or exclude the host from interception

Example fix

// before
if err := cmd.Run(); err != nil {
	return fmt.Errorf("curl download failed for '%s': %w", path.Base(r.URL), err)
}

// after: recover from unsupported resume by restarting the download
if err := cmd.Run(); err != nil {
	var ee *exec.ExitError
	if errors.As(err, &ee) && ee.ExitCode() == 33 {
		_ = os.Remove(destPath) // discard partial file
		if retry := freshCommand(r, destPath); retry != nil { // same args minus -C -
			if err2 := retry.Run(); err2 != nil {
				return fmt.Errorf("curl download failed for '%s': %w", path.Base(r.URL), err2)
			}
			terminal.ClearLine()
			return nil
		}
	}
	return fmt.Errorf("curl download failed for '%s': %w", path.Base(r.URL), err)
}
Defensive patterns

Strategy: retry

Try / catch

var ee *exec.ExitError
if errors.As(err, &ee) {
	switch ee.ExitCode() {
	case 33: // resume unsupported: remove the partial file and retry without -C -
	case 22: // HTTP error: verify the URL before retrying
	case 6, 7: // connectivity: retry with backoff
	case 60: // TLS trust: fix the CA bundle, do not retry blindly
	}
}

Prevention

When it happens

Trigger: 404/410 after the artifact moved (exit 22); network or DNS outage (6/7); TLS-intercepting proxy with an untrusted CA (60); retrying against a server that does not support byte ranges while a partial destPath file exists (33).

Common situations: Interrupted downloads leaving partial files that then break every subsequent resume; relocated release artifacts; corporate TLS inspection.

Related errors


AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15). Data as JSON: /api/errors/c289f3bae0e1a9f0. Report an issue: GitHub.