{"record":{"id":"be4bad1f1264aaf6","repo":"fish2018/pansou","slug":"s-http-d-be4bad","errorCode":null,"errorMessage":"[%s] 搜索请求HTTP状态错误: %d","messagePattern":"\\[(.+?)\\] 搜索请求HTTP状态错误: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/javdb/javdb.go","lineNumber":214,"sourceCode":"\t}\n\tdefer resp.Body.Close()\n\n\tif p.debugMode {\n\t\tlog.Printf(\"[JAVDB] 搜索请求响应状态: %d\", resp.StatusCode)\n\t}\n\n\t// 检测429限流 - 立即返回，不延迟\n\tif resp.StatusCode == 429 {\n\t\tatomic.StoreInt32(&p.rateLimited, 1)\n\t\tatomic.AddInt32(&p.rateLimitCount, 1)\n\t\tif p.debugMode {\n\t\t\tlog.Printf(\"[JAVDB] ⚡ 检测到429限流，立即返回空结果\")\n\t\t}\n\t\treturn []model.SearchResult{}, nil, true // 返回空结果和限流标志\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"[%s] 搜索请求HTTP状态错误: %d\", p.Name(), resp.StatusCode), false\n\t}\n\n\t// 读取响应体用于调试\n\tbodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] 读取搜索结果失败: %w\", p.Name(), err), false\n\t}\n\n\tif p.debugMode {\n\t\tbodyStr := string(bodyBytes)\n\t\tlog.Printf(\"[JAVDB] 响应体长度: %d\", len(bodyStr))\n\t\t// 输出前500个字符用于调试\n\t\tif len(bodyStr) > 500 {\n\t\t\tlog.Printf(\"[JAVDB] 响应体前500字符: %s\", bodyStr[:500])\n\t\t} else {\n\t\t\tlog.Printf(\"[JAVDB] 完整响应体: %s\", bodyStr)\n\t\t}\n\t}","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/javdb/javdb.go#L196-L232","documentation":"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.","triggerScenarios":"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.","commonSituations":"Site deployes stricter Cloudflare/anti-scraping checks; User-Agent header list becomes stale; cookies/CF clearance missing; site moved the endpoint and returns 404.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Go: verify the endpoint still returns 200 with current headers before scraping\nreq, _ := http.NewRequest(\"GET\", searchURL, nil)\nreq.Header.Set(\"User-Agent\", UserAgent)\nresp, err := http.DefaultClient.Do(req)\nif err == nil && resp.StatusCode != 200 {\n    log.Printf(\"javdb probe returned %d\", resp.StatusCode)\n}","typeGuard":"func isTransientStatus(code int) bool {\n    return code == 429 || code >= 500\n}","tryCatchPattern":"if resp.StatusCode != 200 {\n    if isTransientStatus(resp.StatusCode) {\n        return retryWithBackoff(req)\n    }\n    return nil, fmt.Errorf(\"javdb HTTP %d\", resp.StatusCode), false\n}","preventionTips":["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"],"tags":["http","anti-bot","scraping","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"}