{"record":{"id":"14ab030bee87e403","repo":"wtfutil/wtf","slug":"executing-request-w","errorCode":null,"errorMessage":"executing request: %w","messagePattern":"executing request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/devto/client.go","lineNumber":69,"sourceCode":"\tif username != \"\" {\n\t\tq.Set(\"username\", username)\n\t}\n\tif state != \"\" {\n\t\tq.Set(\"state\", state)\n\t}\n\tif perPage > 0 {\n\t\tq.Set(\"per_page\", fmt.Sprintf(\"%d\", perPage))\n\t}\n\tu.RawQuery = q.Encode()\n\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating request: %w\", err)\n\t}\n\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"executing request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"unexpected status %d from DEV.to API\", resp.StatusCode)\n\t}\n\n\tvar articles []Article\n\tif err := json.NewDecoder(resp.Body).Decode(&articles); err != nil {\n\t\treturn nil, fmt.Errorf(\"decoding response: %w\", err)\n\t}\n\n\treturn articles, nil\n}\n","sourceCodeStart":51,"sourceCodeEnd":84,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/devto/client.go#L51-L84","documentation":"FetchArticles wraps errors from c.httpClient.Do(req) as 'executing request'. This is a transport-level failure: DNS resolution, TCP connect, TLS handshake, timeout, or a canceled context. The request was built fine, but it never got an HTTP response.","triggerScenarios":"httpClient.Do fails during Refresh or a test — no network connectivity, DNS failure for dev.to, TLS errors, client timeout exceeded, or ctx canceled before completion.","commonSituations":"Offline laptop or blocked corporate proxy; missing HTTP_PROXY/HTTPS_PROXY config; too-short custom http.Client.Timeout; caller canceling the context mid-request; dev.to outage.","solutions":["Check basic connectivity to https://dev.to (curl https://dev.to/api/articles)","Configure HTTP(S)_PROXY env vars if behind a corporate proxy","Increase the http.Client timeout or verify ctx deadlines aren't too aggressive","Retry with backoff on transient network errors"],"exampleFix":"// before\nclient := NewClient(\"\")\nclient.httpClient = &http.Client{} // no timeout; hangs then fails\n// after\nclient.httpClient = &http.Client{Timeout: 10 * time.Second}\narticles, err := client.FetchArticles(ctx, tag, user, state, perPage)\nif err != nil {\n    return fmt.Errorf(\"devto fetch: %w\", err)\n}","handlingStrategy":"retry","validationCode":"// optional pre-check before API calls\nresp, err := http.Get(\"https://dev.to/api/articles?per_page=1\")\nif err != nil {\n    return fmt.Errorf(\"dev.to unreachable: %w\", err)\n}\nresp.Body.Close()","typeGuard":null,"tryCatchPattern":"articles, err := client.FetchArticles(ctx, tag, user, state, perPage)\nif err != nil {\n    var netErr net.Error\n    if errors.As(err, &netErr) && netErr.Timeout() {\n        // retry with backoff\n    }\n    return nil, err\n}","preventionTips":["Set an explicit Timeout on the http.Client","Configure HTTP(S)_PROXY for corporate networks","Use context with a sane deadline and retry transient failures with backoff"],"tags":["devto","network","http","go"],"backgroundTag":"network-request-failed","analyzedSha":"bb838c1ccb0f0f3223690df44afdec663d622881","analyzedAt":"2026-09-03T17:02:45.030Z","contentChangedAt":"2026-09-03T17:02:45.030Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}