{"record":{"id":"74e1ed1594d86a22","repo":"router-for-me/CLIProxyAPI","slug":"request-failed-w","errorCode":null,"errorMessage":"request failed: %w","messagePattern":"request failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/httpfetch/httpfetch.go","lineNumber":37,"sourceCode":"// success status, and returns the response body. When maxSize is positive\n// the body is rejected once it exceeds maxSize bytes.\nfunc GetBytes(ctx context.Context, client Doer, requestURL string, headers map[string]string, maxSize int64) ([]byte, error) {\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\treq, errRequest := http.NewRequestWithContext(ctx, http.MethodGet, requestURL, nil)\n\tif errRequest != nil {\n\t\treturn nil, fmt.Errorf(\"create request: %w\", errRequest)\n\t}\n\tfor key, value := range headers {\n\t\tif value != \"\" {\n\t\t\treq.Header.Set(key, value)\n\t\t}\n\t}\n\n\tresp, errDo := client.Do(req)\n\tif errDo != nil {\n\t\treturn nil, fmt.Errorf(\"request failed: %w\", errDo)\n\t}\n\tdefer func() {\n\t\tif errClose := resp.Body.Close(); errClose != nil {\n\t\t\tlog.WithError(errClose).Debug(\"failed to close response body\")\n\t\t}\n\t}()\n\n\tif resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {\n\t\tbody, _ := io.ReadAll(io.LimitReader(resp.Body, 4096))\n\t\treturn nil, fmt.Errorf(\"unexpected status %d: %s\", resp.StatusCode, strings.TrimSpace(string(body)))\n\t}\n\n\treader := io.Reader(resp.Body)\n\tif maxSize > 0 {\n\t\treader = io.LimitReader(resp.Body, maxSize+1)\n\t}\n\tdata, errRead := io.ReadAll(reader)\n\tif errRead != nil {","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/httpfetch/httpfetch.go#L19-L55","documentation":"Error \"request failed: %w\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/httpfetch/httpfetch.go:37 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check network connectivity to the target host and retry.","Inspect the wrapped error for DNS, TLS, or timeout failures."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}