chenhg5/cc-connect · error

HTTP GET %s: %w

Error message

HTTP GET %s: %w

What it means

fetchSkillPresetsFromURL wraps errors from the Go http.Client.Get call with "HTTP GET %s: %w". This is a transport-level failure: the request never completed, so no HTTP status exists. The URL is included so you can tell which preset source failed.

Source

Thrown at core/skill_presets.go:123

	if err != nil {
		if c.data != nil {
			slog.Warn("all skill presets sources failed, using stale cache", "error", err)
			return c.data, nil
		}
		return nil, fmt.Errorf("fetch skill presets: %w", err)
	}

	c.data = result
	c.fetchedAt = time.Now()
	return c.data, nil
}

func fetchSkillPresetsFromURL(url string, timeout time.Duration) (*SkillPresetsResponse, error) {
	slog.Debug("fetching skill presets", "url", url)
	client := &http.Client{Timeout: timeout}
	resp, err := client.Get(url)
	if err != nil {
		return nil, fmt.Errorf("HTTP GET %s: %w", url, err)
	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("HTTP GET %s: status %d", url, resp.StatusCode)
	}

	body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
	if err != nil {
		return nil, fmt.Errorf("read body from %s: %w", url, err)
	}

	var result SkillPresetsResponse
	if err := json.Unmarshal(body, &result); err != nil {
		return nil, fmt.Errorf("parse JSON from %s: %w", url, err)
	}
	return &result, nil
}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. curl the URL from the same host to reproduce: curl -v <url>
  2. Fix DNS/proxy issues (HTTPS_PROXY env, /etc/hosts, VPN) or correct the URL in config
  3. Retry — transient network blips and timeouts are common; the fetch caller aggregates multiple sources
  4. If the URL is consistently unreachable, remove or replace that source

Example fix

// before
url = "http://presets.internal.example/skills.json"
// after
url = "https://presets.example.com/skills.json"  # verify with curl first
Defensive patterns

Strategy: retry

Validate before calling

u, err := url.Parse(sourceURL)
if err != nil { return fmt.Errorf("invalid presets URL: %w", err) }
if u.Scheme != "http" && u.Scheme != "https" { return fmt.Errorf("unsupported scheme %q", u.Scheme) }
// optional connectivity pre-check
conn, err := net.DialTimeout("tcp", net.JoinHostPort(u.Hostname(), portOrDefault(u)), 3*time.Second)
if err != nil { return fmt.Errorf("preset host unreachable: %w", err) }
conn.Close()

Try / catch

var presets *SkillPresetsResponse
var lastErr error
for attempt := 0; attempt < 3; attempt++ {
    presets, lastErr = fetchSkillPresetsFromURL(url, timeout)
    if lastErr == nil { break }
    if strings.HasPrefix(lastErr.Error(), "HTTP GET") { time.Sleep(time.Duration(attempt+1) * 2 * time.Second) }
}
if lastErr != nil { slog.Error("presets fetch failed after retries", "url", url, "err", lastErr) }

Prevention

When it happens

Trigger: DNS resolution failure, connection refused, TLS handshake error, or request timeout (the client uses a per-fetch timeout) while GETting a skill presets source URL from fetch.

Common situations: Offline laptop / air-gapped server; typo'd scheme or host in the presets URL; corporate proxy requiring configuration; long timeout hit on a slow mirror.

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 chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/07059531a3bf762a. Report an issue: GitHub.