{"record":{"id":"07059531a3bf762a","repo":"chenhg5/cc-connect","slug":"http-get-s-w-070595","errorCode":null,"errorMessage":"HTTP GET %s: %w","messagePattern":"HTTP GET (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/skill_presets.go","lineNumber":123,"sourceCode":"\tif err != nil {\n\t\tif c.data != nil {\n\t\t\tslog.Warn(\"all skill presets sources failed, using stale cache\", \"error\", err)\n\t\t\treturn c.data, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"fetch skill presets: %w\", err)\n\t}\n\n\tc.data = result\n\tc.fetchedAt = time.Now()\n\treturn c.data, nil\n}\n\nfunc fetchSkillPresetsFromURL(url string, timeout time.Duration) (*SkillPresetsResponse, error) {\n\tslog.Debug(\"fetching skill presets\", \"url\", url)\n\tclient := &http.Client{Timeout: timeout}\n\tresp, err := client.Get(url)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"HTTP GET %s: %w\", url, err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"HTTP GET %s: status %d\", url, resp.StatusCode)\n\t}\n\n\tbody, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read body from %s: %w\", url, err)\n\t}\n\n\tvar result SkillPresetsResponse\n\tif err := json.Unmarshal(body, &result); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse JSON from %s: %w\", url, err)\n\t}\n\treturn &result, nil\n}","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/skill_presets.go#L105-L141","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["curl the URL from the same host to reproduce: curl -v <url>","Fix DNS/proxy issues (HTTPS_PROXY env, /etc/hosts, VPN) or correct the URL in config","Retry — transient network blips and timeouts are common; the fetch caller aggregates multiple sources","If the URL is consistently unreachable, remove or replace that source"],"exampleFix":"// before\nurl = \"http://presets.internal.example/skills.json\"\n// after\nurl = \"https://presets.example.com/skills.json\"  # verify with curl first","handlingStrategy":"retry","validationCode":"u, err := url.Parse(sourceURL)\nif err != nil { return fmt.Errorf(\"invalid presets URL: %w\", err) }\nif u.Scheme != \"http\" && u.Scheme != \"https\" { return fmt.Errorf(\"unsupported scheme %q\", u.Scheme) }\n// optional connectivity pre-check\nconn, err := net.DialTimeout(\"tcp\", net.JoinHostPort(u.Hostname(), portOrDefault(u)), 3*time.Second)\nif err != nil { return fmt.Errorf(\"preset host unreachable: %w\", err) }\nconn.Close()","typeGuard":null,"tryCatchPattern":"var presets *SkillPresetsResponse\nvar lastErr error\nfor attempt := 0; attempt < 3; attempt++ {\n    presets, lastErr = fetchSkillPresetsFromURL(url, timeout)\n    if lastErr == nil { break }\n    if strings.HasPrefix(lastErr.Error(), \"HTTP GET\") { time.Sleep(time.Duration(attempt+1) * 2 * time.Second) }\n}\nif lastErr != nil { slog.Error(\"presets fetch failed after retries\", \"url\", url, \"err\", lastErr) }","preventionTips":["curl the source URL from the deployment host before relying on it","Configure HTTPS_PROXY correctly in containerized/CI environments","Keep per-fetch timeouts generous enough for slow mirrors; retry transient failures"],"tags":["network","http","dns","timeout"],"backgroundTag":"http-request-failed","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}