{"record":{"id":"48faa00236e2bb5a","repo":"fish2018/pansou","slug":"http-d-48faa0","errorCode":null,"errorMessage":"HTTP %d","messagePattern":"HTTP %d","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/gaoqing888/gaoqing888.go","lineNumber":350,"sourceCode":"\t\treq.Header.Set(\"Accept\", \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\")\n\t\treq.Header.Set(\"Accept-Language\", \"zh-CN,zh;q=0.9,en;q=0.8\")\n\t\treq.Header.Set(\"Connection\", \"keep-alive\")\n\t\treq.Header.Set(\"Referer\", referer)\n\n\t\tresp, err := client.Do(req)\n\t\tif err == nil && resp.StatusCode == http.StatusOK {\n\t\t\tdefer resp.Body.Close()\n\t\t\tdata, readErr := io.ReadAll(resp.Body)\n\t\t\tcancel()\n\t\t\treturn data, readErr\n\t\t}\n\t\tif resp != nil {\n\t\t\tresp.Body.Close()\n\t\t}\n\t\tif err != nil {\n\t\t\tlastErr = err\n\t\t} else {\n\t\t\tlastErr = fmt.Errorf(\"HTTP %d\", resp.StatusCode)\n\t\t}\n\t\tcancel()\n\t\tif attempt < maxRetries-1 {\n\t\t\ttime.Sleep(200 * time.Millisecond * time.Duration(1<<attempt))\n\t\t}\n\t}\n\treturn nil, lastErr\n}\n","sourceCodeStart":332,"sourceCodeEnd":359,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/gaoqing888/gaoqing888.go#L332-L359","documentation":"Internal retry-loop error in fetchBody: a retry attempt received an HTTP response with a non-2xx status code. This becomes lastErr for the attempt and, if all attempts fail, is the cause wrapped in the error returned by fetchDocument. Not normally seen directly by callers.","triggerScenarios":"fetchBody: client.Do returned no transport error but resp.StatusCode was not a success code on the final attempt; each failing attempt closes the body and backs off exponentially (200ms * 2^attempt).","commonSituations":"Rate limiting (429), CDN 502/503 during site load spikes, 403 from bot detection or missing cookies, 404 after site URL restructure.","solutions":["Note the exact status code: 429 → slow down; 403 → fix headers/cookies; 5xx → upstream outage.","Update request headers (User-Agent, Referer, cookies) to pass bot checks.","Lengthen the backoff schedule or retry count for flaky upstreams.","Verify the URL still exists after any site redesign."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"resp, err := http.Get(targetURL)\nif err == nil && resp.StatusCode != 200 {\n    log.Printf(\"upstream status %d before calling plugin\", resp.StatusCode)\n}","typeGuard":null,"tryCatchPattern":"if err := fetchDocument(...); err != nil {\n    if strings.Contains(err.Error(), \"HTTP \") {\n        code := extractStatus(err)\n        if code == 429 {\n            time.Sleep(rateLimitCooldown)\n        }\n    }\n    return err\n}","preventionTips":["Throttle request rate to stay under upstream limits (avoid 429)","Keep cookies/User-Agent fresh to avoid 403","Use longer exponential backoff for 5xx responses","Update URLs after site restructures to avoid 404"],"tags":["http","status-code","retry","go"],"backgroundTag":"http-non-200-response","analyzedSha":"beaa56133755a548ebc51b090b3816e2ae044aa6","analyzedAt":"2026-09-07T00:31:18.025Z","contentChangedAt":"2026-09-07T00:31:18.025Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}