{"record":{"id":"11d4c612ceefae63","repo":"fish2018/pansou","slug":"w-11d4c6","errorCode":null,"errorMessage":"发送搜索请求失败: %w","messagePattern":"发送搜索请求失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/libvio/libvio.go","lineNumber":135,"sourceCode":"\t\tlog.Printf(\"[Libvio] 响应状态: %d\", resp.StatusCode)\n\t}\n\n\treturn resp, nil\n}\n\n// searchImpl 实际的搜索实现\nfunc (p *LibvioPlugin) searchImpl(client *http.Client, keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {\n\tsearchURL := fmt.Sprintf(\"%s%s?wd=%s&submit=\", BaseURL, SearchPath, url.QueryEscape(keyword))\n\n\tif p.debugMode {\n\t\tlog.Printf(\"[Libvio] 开始搜索: %s\", keyword)\n\t\tlog.Printf(\"[Libvio] 搜索URL: %s\", searchURL)\n\t}\n\n\t// 发送搜索请求\n\tresp, err := p.doRequest(client, searchURL, BaseURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"发送搜索请求失败: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"搜索响应状态码异常: %d\", resp.StatusCode)\n\t}\n\n\t// 处理响应体（可能是gzip压缩的）\n\treader, err := p.getResponseReader(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// 解析HTML\n\tdoc, err := goquery.NewDocumentFromReader(reader)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"解析HTML失败: %w\", err)\n\t}","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/libvio/libvio.go#L117-L153","documentation":"searchImpl in the libvio plugin wraps errors from p.doRequest (the HTTP GET to the search URL) with this message. The request failed before any response was available; the underlying transport error is chained via %w.","triggerScenarios":"p.doRequest(client, searchURL, BaseURL) returns a non-nil error during a keyword search: connection refused/reset, DNS failure, TLS error, timeout, or proxy failure.","commonSituations":"libvio site is down or blocks datacenter IPs; TLS fingerprint blocking of Go's default client; DNS failure in containerized deployments; client timeout too short; site domain changed.","solutions":["Inspect the wrapped cause from %w for the transport-level reason","Verify the site is reachable with curl from the same host; update BaseURL if the domain moved","Increase the HTTP client timeout and add retry with backoff","Adjust headers (User-Agent, Referer) or use a proxy if the site blocks automated traffic","Check for TLS interception issues and enable InsecureSkipVerify only for diagnostics"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"u, err := url.Parse(searchURL)\nif err != nil || u.Host == \"\" {\n    return fmt.Errorf(\"invalid libvio search URL: %q\", searchURL)\n}","typeGuard":null,"tryCatchPattern":"results, err := plugin.Search(ctx, keyword)\nif err != nil {\n    if strings.Contains(err.Error(), \"发送搜索请求失败\") {\n        cause := errors.Unwrap(err)\n        log.Printf(\"libvio transport failure: %v\", cause)\n        return fallbackSearch(keyword)\n    }\n    return err\n}","preventionTips":["Health-check the libvio domain and update BaseURL on domain changes","Use a browser-like User-Agent/Referer to reduce bot blocking","Add retry with backoff for transient transport errors","Verify TLS works with Go's client (some sites block non-browser TLS fingerprints)","Log errors.Unwrap(err) so the root transport cause is visible"],"tags":["go","http","network","scraping"],"backgroundTag":"http-request-failed","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"}