fish2018/pansou · error
[ ] 请求返回状态码
Error message
[%s] 请求返回状态码: %d
What it means
searchPage returns this error when the HTTP response from xcili.net has a StatusCode other than 200. Unlike error 756 there is no wrapped cause — only the numeric status is reported. The plugin treats any non-200 (403 anti-bot, 429 rate limit, 5xx, redirects to error pages) as a failed search.
Solutions
- Note the status code in the message: 403/503 → anti-bot/Cloudflare, 429 → rate limited, 5xx → site problem
- Reduce MaxConcurrency and MaxPages to lower request pressure
- Add delays/backoff between page fetches; honor Retry-After on 429
- Use a more complete browser-like header set (Accept, Accept-Language, cookies) to pass WAF checks
- Retry later if it's a transient 5xx
Example fix
// before
if resp.StatusCode != 200 {
return nil, fmt.Errorf("[%s] 请求返回状态码: %d", p.Name(), resp.StatusCode)
}
// after
if resp.StatusCode == 429 || resp.StatusCode == 503 {
time.Sleep(2 * time.Second)
// retry once before failing
} else if resp.StatusCode != 200 {
return nil, fmt.Errorf("[%s] 请求返回状态码: %d", p.Name(), resp.StatusCode)
} Defensive patterns
Strategy: retry
Validate before calling
// pre-check upstream health before searching
resp, err := http.Head("https://xcili.net")
if err != nil || (resp != nil && resp.StatusCode != 200) {
return fmt.Errorf("wuji upstream unhealthy (status %v)", resp)
} Try / catch
results, err := p.Search(keyword, ext)
if err != nil {
var statusErr *fmt.Errorf
if strings.Contains(err.Error(), "请求返回状态码: 429") {
time.Sleep(backoff)
// retry after rate-limit backoff
}
} Prevention
- Lower MaxConcurrency/MaxPages to avoid tripping 429 rate limits
- Add jittered delays between concurrent page fetches
- Send full browser-like headers to pass WAF/Cloudflare checks
- Monitor status codes logged by the plugin and back off on repeated 403/429
When it happens
Trigger: p.doRequestWithRetry succeeded at transport level but resp.StatusCode != 200: the site returned 403 (Cloudflare/WAF block), 429 (too many requests from MaxConcurrency=10 parallel page fetches), 5xx, or an unexpected redirect target.
Common situations: Server IP rate-limited or blacklisted by the site's WAF; concurrency of up to 10 simultaneous page requests tripping 429; site under Cloudflare challenge; site temporarily down with 502/503.
Related errors
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/e60620eac26f1239.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/wuji/wuji.go:197
// 创建请求
req, err := http.NewRequestWithContext(ctx, "GET", searchURL, nil)
if err != nil {
return nil, fmt.Errorf("[%s] 创建请求失败: %w", p.Name(), err)
}
// 设置请求头
p.setRequestHeaders(req)
// 发送HTTP请求
resp, err := p.doRequestWithRetry(req, client)
if err != nil {
return nil, fmt.Errorf("[%s] 搜索请求失败: %w", p.Name(), err)
}
defer resp.Body.Close()
// 检查状态码
if resp.StatusCode != 200 {
return nil, fmt.Errorf("[%s] 请求返回状态码: %d", p.Name(), resp.StatusCode)
}
// 读取响应体内容
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("[%s] 读取响应失败: %w", p.Name(), err)
}
// 解析HTML
doc, err := goquery.NewDocumentFromReader(strings.NewReader(string(body)))
if err != nil {
return nil, fmt.Errorf("[%s] HTML解析失败: %w", p.Name(), err)
}
// 提取搜索结果
return p.extractSearchResults(doc), nil
}
View on GitHub (pinned to beaa561337)