chenhg5/cc-connect · error
fetch presets: %w
Error message
fetch presets: %w
What it means
The provider presets cache fetcher tried all configured preset sources and every one failed. Because there was no previously cached result (`c.data == nil`), it cannot fall back to stale data and instead returns a wrapped aggregate error via `fmt.Errorf("fetch presets: %w", err)`. It signals that provider preset data (e.g. model/provider lists shown in the UI) is completely unavailable, not just stale.
Source
Thrown at core/provider_presets.go:127
return c.data, nil
}
primaryURL := c.url
if primaryURL == "" {
primaryURL = defaultPresetsURL
}
result, err := fetchPresetsFromURL(primaryURL, presetsHTTPTimeout)
if err != nil {
slog.Warn("primary presets fetch failed, trying fallback", "url", primaryURL, "error", err)
result, err = fetchPresetsFromURL(fallbackPresetsURL, presetsFallbackHTTPTimeout)
}
if err != nil {
if c.data != nil {
slog.Warn("all presets sources failed, using stale cache", "error", err)
return c.data, nil
}
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)View on GitHub (pinned to 4000b2338a)
Solutions
- Verify network connectivity to the presets source URL (curl the URL configured as the presets source).
- Fix the presets source URL in config.toml if it is wrong or unreachable.
- Configure a local/alternative presets source URL that is reachable from the host.
- If offline operation is expected, accept degraded behavior or pre-populate the cache by running once with network access.
Example fix
// before
data, err := cache.Fetch(ctx)
if err != nil { return err }
// after
data, err := cache.Fetch(ctx)
if err != nil {
slog.Warn("provider presets unavailable, using built-in defaults", "error", err)
data = defaultPresets
} Defensive patterns
Strategy: fallback
Validate before calling
u, err := url.Parse(presetsSourceURL)
if err != nil || u.Host == "" { return fmt.Errorf("bad presets source %q", presetsSourceURL) }
// optionally: ping the URL once at startup before relying on it Try / catch
data, err := cache.Fetch(ctx)
if err != nil {
slog.Warn("presets unavailable, using defaults", "error", err)
data = defaultPresets
} Prevention
- Monitor the presets source URL with a periodic health check.
- Keep a built-in default preset list as a last-resort fallback.
- Document the required network egress for deployments behind firewalls.
When it happens
Trigger: Calling the exported fetch path on the presets cache when (a) every source URL failed to fetch (network down, DNS failure, non-200 responses) AND (b) no successful fetch ever happened before, so `c.data` is nil.
Common situations: Running cc-connect offline or behind a corporate proxy that blocks the presets URL; misconfigured presets source URL in config; DNS resolution failure on a fresh install before the first successful fetch populated the cache.
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
- request usage endpoint: %w
- HTTP GET %s: %w
- HTTP GET %s: status %d
- read body from %s: %w
- fetch skill presets: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/40e34a84c3763052.
Report an issue: GitHub.