chenhg5/cc-connect · error
HTTP GET %s: status %d
Error message
HTTP GET %s: status %d
What it means
`fetchPresetsFromURL` requires HTTP 200; any other status (404, 403, 500, etc.) aborts with `HTTP GET <url>: status <code>`. The request reached the server but the server rejected it or failed internally.
Source
Thrown at core/provider_presets.go:145
return nil, fmt.Errorf("fetch presets: %w", err)
}
c.data = result
c.fetchedAt = time.Now()
return c.data, nil
}
func fetchPresetsFromURL(url string, timeout time.Duration) (*ProviderPresetsResponse, error) {
slog.Debug("fetching provider 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 ProviderPresetsResponse
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
- Open the URL in a browser/curl and read the returned status code to identify the cause.
- Update the configured presets source URL if the resource moved (404).
- Add authentication or switch to a public mirror if you get 401/403.
- Retry later or add a retry with backoff for transient 5xx/429 responses.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check (optional, racy but catches obvious 404s):
resp, err := http.Head(presetsURL)
if err == nil && resp.StatusCode != http.StatusOK { /* fix URL or warn */ } Try / catch
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("unexpected status %d from %s", resp.StatusCode, url) // log and fall back to cache
} Prevention
- Pin the presets source URL and update it when the upstream moves.
- Alert on 4xx/5xx from the presets host.
- Add retry-with-backoff for 429/5xx and fail fast (with cache fallback) on 4xx.
When it happens
Trigger: Calling fetchPresetsFromURL against a URL whose response `resp.StatusCode != http.StatusOK` — e.g. the presets file was moved (404), the host requires auth (401/403), or the server is erroring (5xx).
Common situations: Upstream repository restructured so the presets JSON path changed; GitHub raw URL pointing at a private repo; CDN returning 502/503 during an outage; rate-limiting (429).
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- request usage endpoint: %w
- fetch presets: %w
- HTTP GET %s: %w
- read body from %s: %w
- minimax tts: request: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/d0592e85114c846f.
Report an issue: GitHub.