{"record":{"id":"169a45405b8d3957","repo":"Billionmail/BillionMail","slug":"http-get-error-s","errorCode":null,"errorMessage":"http get error: %s","messagePattern":"http get error: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/public/common.go","lineNumber":314,"sourceCode":"\tcontext, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(context), nil\n}\n\n// Native HTTP GET request\nfunc HttpGetSrc(url string, timeout int) (respBody string, err error) {\n\tclient := GetHttpClient(timeout)\n\tresp, err := client.Get(url)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Check status code\n\tif resp.StatusCode < http.StatusOK && resp.StatusCode >= http.StatusMultipleChoices {\n\t\terr = fmt.Errorf(\"http get error: %s\", resp.Status)\n\t}\n\n\tvar bs []byte\n\tbs, err = io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trespBody = string(bs)\n\n\treturn\n}\n\n// Send GET request and return JSON data\nfunc HttpGetJson(url string, timeout int, pointer interface{}) (err error) {\n\tvar respBody string\n\n\tif respBody, err = HttpGetSrc(url, timeout); err != nil {","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/public/common.go#L296-L332","documentation":"Status guard in HttpGetSrc: the HTTP request completed, but resp.StatusCode is outside 200-299 (the condition flags anything below OK or >= 300), so the body is not trusted and an error carrying resp.Status (e.g. '404 Not Found') is set before the body is read. Note the logic also misfires on 3xx, which are redirects rather than failures.","triggerScenarios":"Thrown at core/internal/service/public/common.go:314 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log or inspect the embedded HTTP status to identify 4xx/5xx causes at the target URL","Retry with backoff for transient 5xx responses","Fix the range check to only treat >=400 as error if 3xx handling is undesired","Check redirect handling/configured timeout on GetHttpClient when odd statuses appear"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fc36c76c050c3775c5e899faf7403cf0262d2744","analyzedAt":"2026-09-05T21:28:54.019Z","contentChangedAt":"2026-09-05T21:28:54.019Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}