{"record":{"id":"32aa91ff9c6045f3","repo":"fish2018/pansou","slug":"http-d-32aa91","errorCode":null,"errorMessage":"HTTP状态码: %d","messagePattern":"HTTP状态码: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/feikuai/feikuai.go","lineNumber":538,"sourceCode":"\tvar lastErr error\n\n\tfor i := 0; i < maxRetries; i++ {\n\t\tif i > 0 {\n\t\t\t// 指数退避\n\t\t\tbackoff := time.Duration(1<<uint(i-1)) * 200 * time.Millisecond\n\t\t\ttime.Sleep(backoff)\n\t\t}\n\n\t\t// 克隆请求避免并发问题\n\t\treqClone := req.Clone(req.Context())\n\n\t\tresp, err := client.Do(reqClone)\n\t\tif err == nil {\n\t\t\tif resp.StatusCode == 200 {\n\t\t\t\treturn resp, nil\n\t\t\t}\n\t\t\tresp.Body.Close()\n\t\t\tlastErr = fmt.Errorf(\"HTTP状态码: %d\", resp.StatusCode)\n\t\t} else {\n\t\t\tlastErr = err\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"[%s] 重试 %d 次后仍然失败: %w\", p.Name(), maxRetries, lastErr)\n}\n","sourceCodeStart":520,"sourceCodeEnd":546,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/feikuai/feikuai.go#L520-L546","documentation":"Internal retry bookkeeping error in doRequestWithRetry: the HTTP request succeeded but the server returned a status code other than 200. This value becomes lastErr and is surfaced wrapped by the '重试 N 次后仍然失败' error. It is not usually seen directly by callers, only as the wrapped cause.","triggerScenarios":"doRequestWithRetry: client.Do succeeded but resp.StatusCode != 200 on every attempt; the last such status is stored as lastErr.","commonSituations":"Target site rate-limiting (429), temporary 502/503 from CDN, 403 due to missing/rotated cookies, bot detection returning 4xx/5xx.","solutions":["Check the reported status code: 403/429 usually means auth or rate limiting; 5xx means the upstream server is having issues.","Update cookies/User-Agent for the feikuai site if the site tightened bot detection.","Increase backoff between retries or reduce request frequency.","Verify the target URL is still valid (site may have moved, returning 404)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"resp, err := http.Head(targetURL)\nif err == nil && resp.StatusCode >= 400 {\n    log.Printf(\"upstream currently returns %d; skipping attempt\", resp.StatusCode)\n}","typeGuard":null,"tryCatchPattern":"results, err := searchImpl(keyword)\nif err != nil {\n    var wrapped interface{ Unwrap() error }\n    if errors.As(err, &retryErr{}) {\n        log.Printf(\"upstream status issue: %v\", err)\n        return backoffThenRetryOrFallback()\n    }\n    return err\n}","preventionTips":["Respect rate limits; add jittered backoff between requests","Keep cookies and User-Agent current to avoid 403/429","Alert on sustained non-200 status codes for the upstream","Cache last good results to serve during upstream incidents"],"tags":["http","status-code","retry","go"],"backgroundTag":"http-error-status","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"}