{"record":{"id":"a6582178977d3170","repo":"router-for-me/CLIProxyAPI","slug":"create-request-w-a65821","errorCode":null,"errorMessage":"create request: %w","messagePattern":"create request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/httpfetch/httpfetch.go","lineNumber":27,"sourceCode":"\n\tlog \"github.com/sirupsen/logrus\"\n)\n\n// Doer abstracts the HTTP client used to execute requests.\ntype Doer interface {\n\tDo(*http.Request) (*http.Response, error)\n}\n\n// GetBytes performs a GET request with the supplied headers, requires a\n// 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 {","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/httpfetch/httpfetch.go#L9-L45","documentation":"Error \"create request: %w\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/httpfetch/httpfetch.go:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the target URL is valid and the HTTP client is initialized.","Check the wrapped error for request construction details."],"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"}