{"record":{"id":"fd201f310bcdbf04","repo":"fish2018/pansou","slug":"s-d-fd201f","errorCode":null,"errorMessage":"[%s] 搜索请求返回状态码: %d","messagePattern":"\\[(.+?)\\] 搜索请求返回状态码: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/zhizhen/zhizhen.go","lineNumber":223,"sourceCode":"\n\t// 4. 设置完整的请求头（避免反爬虫）\n\treq.Header.Set(\"User-Agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\")\n\treq.Header.Set(\"Accept\", \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\")\n\treq.Header.Set(\"Accept-Language\", \"zh-CN,zh;q=0.9,en;q=0.8\")\n\treq.Header.Set(\"Connection\", \"keep-alive\")\n\treq.Header.Set(\"Upgrade-Insecure-Requests\", \"1\")\n\treq.Header.Set(\"Cache-Control\", \"max-age=0\")\n\treq.Header.Set(\"Referer\", strings.TrimRight(baseURL, \"/\")+\"/\")\n\n\t// 5. 发送请求（带重试机制）\n\tresp, err := p.doRequestWithRetry(req, client)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] 搜索请求失败: %w\", p.Name(), err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"[%s] 搜索请求返回状态码: %d\", p.Name(), resp.StatusCode)\n\t}\n\n\t// 6. 解析搜索结果页面\n\tdoc, err := goquery.NewDocumentFromReader(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] 解析搜索页面失败: %w\", p.Name(), err)\n\t}\n\n\t// 7. 提取搜索结果\n\tvar results []model.SearchResult\n\n\tdoc.Find(\".module-search-item\").Each(func(i int, s *goquery.Selection) {\n\t\tresult := p.parseSearchItem(s, keyword)\n\t\tif result.UniqueID != \"\" {\n\t\t\tresults = append(results, result)\n\t\t}\n\t})\n","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/zhizhen/zhizhen.go#L205-L241","documentation":"This error indicates zhizhen's searchAtBase received an HTTP response whose status code was not 200 after a successful (retried) request. Unlike the yunsou plugin, the retry loop here treats any completed response as success, so non-200 statuses are checked and rejected explicitly right after. The plugin could not get a usable search page from that mirror.","triggerScenarios":"resp.StatusCode != 200 immediately after doRequestWithRetry succeeds — typically 301/302 followed to an error page, 403 WAF block, 429 rate limit, or 5xx from the mirror.","commonSituations":"Anti-bot protection on the mirror, mirror serving a maintenance page, domain redirecting to a parking/advert page after the site migrated, or rate limiting under concurrent searches.","solutions":["Log the actual status code (it's included in the message) and the response body snippet.","If 403/429, update User-Agent/Referer headers or add delays between requests.","If 301/302 to a new domain, update the plugin's base URL list.","Check the mirror's health manually with curl -I.","Let searchImpl fall back to another base URL (its normal behavior for this case)."],"exampleFix":"// before\nif resp.StatusCode != 200 {\n    return nil, fmt.Errorf(\"[%s] 搜索请求返回状态码: %d\", p.Name(), resp.StatusCode)\n}\n// after\nif resp.StatusCode != 200 {\n    body, _ := io.ReadAll(io.LimitReader(resp.Body, 256))\n    return nil, fmt.Errorf(\"[%s] 搜索请求返回状态码: %d, body: %q\", p.Name(), resp.StatusCode, body)\n}","handlingStrategy":"fallback","validationCode":"resp, err := http.Get(strings.TrimRight(baseURL, \"/\") + \"/\")\nif err == nil && resp.StatusCode == 301 {\n    // mirror moved — resolve new location before searching\n}","typeGuard":null,"tryCatchPattern":"results, err := searchAtBase(client, baseURL, keyword)\nif err != nil && strings.Contains(err.Error(), \"状态码\") {\n    return searchAtBase(client, nextBaseURL, keyword) // try mirror fallback\n}","preventionTips":["Log non-200 status codes with body snippets","Update mirror list when domains redirect elsewhere","Handle 403/429 by rotating headers or adding delay","Disable auto-redirect or verify redirect targets"],"tags":["http","status-code","anti-bot","mirror"],"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"}