fish2018/pansou · error
[ ] 搜索请求HTTP状态错误
Error message
[%s] 搜索请求HTTP状态错误: %d
What it means
executeSearchWithRateLimit returns '[javdb] 搜索请求HTTP状态错误: %d' (search request HTTP status error) when the response status is not 200 (and not the specially handled 429 rate-limit case). It indicates javdb responded but rejected the request — commonly a bot-block or server error page.
Solutions
- Log the status code and body snippet to identify 403 vs 5xx vs 404
- Refresh User-Agent/Accept headers and consider cookie handling to pass anti-bot checks
- Enable/verify redirect following on the http.Client (CheckRedirect)
- Retry with backoff on 5xx statuses
- Check whether javdb moved the search endpoint and update searchURL
Defensive patterns
Strategy: retry
Validate before calling
// Go: verify the endpoint still returns 200 with current headers before scraping
req, _ := http.NewRequest("GET", searchURL, nil)
req.Header.Set("User-Agent", UserAgent)
resp, err := http.DefaultClient.Do(req)
if err == nil && resp.StatusCode != 200 {
log.Printf("javdb probe returned %d", resp.StatusCode)
} Type guard
func isTransientStatus(code int) bool {
return code == 429 || code >= 500
} Try / catch
if resp.StatusCode != 200 {
if isTransientStatus(resp.StatusCode) {
return retryWithBackoff(req)
}
return nil, fmt.Errorf("javdb HTTP %d", resp.StatusCode), false
} Prevention
- Keep User-Agent/Accept headers and cookies current to pass anti-bot checks
- Ensure the client follows redirects (CheckRedirect policy)
- Log status + body snippet on every non-200 to classify 403/404/5xx
- Retry with backoff on 5xx, fail fast on 4xx
When it happens
Trigger: client.Do succeeds but resp.StatusCode is anything other than 200 after the 429 branch — e.g. 403 from anti-bot protection, 301/302 not followed due to redirect policy, 503 from upstream overload.
Common situations: Site deployes stricter Cloudflare/anti-scraping checks; User-Agent header list becomes stale; cookies/CF clearance missing; site moved the endpoint and returns 404.
Related errors
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/be4bad1f1264aaf6.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/javdb/javdb.go:214
}
defer resp.Body.Close()
if p.debugMode {
log.Printf("[JAVDB] 搜索请求响应状态: %d", resp.StatusCode)
}
// 检测429限流 - 立即返回,不延迟
if resp.StatusCode == 429 {
atomic.StoreInt32(&p.rateLimited, 1)
atomic.AddInt32(&p.rateLimitCount, 1)
if p.debugMode {
log.Printf("[JAVDB] ⚡ 检测到429限流,立即返回空结果")
}
return []model.SearchResult{}, nil, true // 返回空结果和限流标志
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("[%s] 搜索请求HTTP状态错误: %d", p.Name(), resp.StatusCode), false
}
// 读取响应体用于调试
bodyBytes, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("[%s] 读取搜索结果失败: %w", p.Name(), err), false
}
if p.debugMode {
bodyStr := string(bodyBytes)
log.Printf("[JAVDB] 响应体长度: %d", len(bodyStr))
// 输出前500个字符用于调试
if len(bodyStr) > 500 {
log.Printf("[JAVDB] 响应体前500字符: %s", bodyStr[:500])
} else {
log.Printf("[JAVDB] 完整响应体: %s", bodyStr)
}
}View on GitHub (pinned to beaa561337)