{"record":{"id":"12d4dc5947c3e9bc","repo":"fish2018/pansou","slug":"s-w-12d4dc","errorCode":null,"errorMessage":"[%s] 搜索请求失败: %w","messagePattern":"\\[(.+?)\\] 搜索请求失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/dyyj/dyyj.go","lineNumber":258,"sourceCode":"\t\t}\n\t\treturn nil, fmt.Errorf(\"[%s] 创建搜索请求失败: %w\", p.Name(), err)\n\t}\n\n\t// 设置完整的请求头\n\treq.Header.Set(\"User-Agent\", UserAgent)\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\", BaseURL+\"/\")\n\n\tresp, err := p.doRequestWithRetry(req, client)\n\tif err != nil {\n\t\tif p.debugMode {\n\t\t\tlog.Printf(\"[DYYJ] 搜索请求失败: %v\", err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"[%s] 搜索请求失败: %w\", p.Name(), err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif p.debugMode {\n\t\tlog.Printf(\"[DYYJ] 搜索请求响应状态码: %d\", resp.StatusCode)\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\tif p.debugMode {\n\t\t\tlog.Printf(\"[DYYJ] 搜索请求HTTP状态错误: %d\", resp.StatusCode)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"[%s] 搜索请求HTTP状态错误: %d\", p.Name(), resp.StatusCode)\n\t}\n\n\t// 读取响应体用于调试\n\tbodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\tif p.debugMode {","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/dyyj/dyyj.go#L240-L276","documentation":"The HTTP GET issued by dyyj.executeSearchHTML failed after doRequestWithRetry exhausted its attempts. This wraps transport-level failures: DNS resolution failure, TCP connect refused/reset, TLS handshake errors, or context deadline exceeded. Retries have already happened inside doRequestWithRetry.","triggerScenarios":"p.doRequestWithRetry(req, client) returned a non-nil error — DNS failure for the site domain, connection refused, TLS certificate problems, timeout from the ctx created with RequestTimeout, or proxy misconfiguration.","commonSituations":"The site is down or blocks the host's IP/region; corporate proxy needed but not configured; DNS cannot resolve a changed domain; RequestTimeout too small for a slow site; GFW/network filtering in the deployment environment.","solutions":["Check connectivity: curl -v the same searchURL from the host","Inspect the wrapped error (timeout vs connection refused vs TLS) to pick the fix","Increase RequestTimeout if timeouts are the cause","Configure HTTP(S)_PROXY if the host needs a proxy to reach the site","Verify DNS (dig/nslookup) — the domain may have changed"],"exampleFix":"// before\nclient := &http.Client{}\n// after\nclient := &http.Client{\n\tTimeout: 30 * time.Second,\n\tTransport: &http.Transport{\n\t\tProxy: http.ProxyFromEnvironment,\n\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t},\n}","handlingStrategy":"retry","validationCode":"if !isReachable(BaseURL) { return errors.New(\"site unreachable, skipping search\") }\n// isReachable: quick TCP dial or HEAD with short timeout before batch search runs","typeGuard":null,"tryCatchPattern":"var netErr net.Error\nif errors.As(err, &netErr) && netErr.Timeout() {\n\treturn nil, fmt.Errorf(\"search timed out after retries: %w\", err)\n}\nreturn nil, fmt.Errorf(\"search transport failed: %w\", err)","preventionTips":["Configure proxy environment variables if the host needs one","Use sane timeouts (connect + total) on the http.Client","Monitor DNS changes for the target domain","Prefer bounded retries with exponential backoff, which doRequestWithRetry already does"],"tags":["network","http","go","timeout"],"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"}