{"record":{"id":"6f41827bb8d3ce71","repo":"fish2018/pansou","slug":"s-w-6f4182","errorCode":null,"errorMessage":"[%s] 访问首页失败: %w","messagePattern":"\\[(.+?)\\] 访问首页失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/jsnoteclub/jsnoteclub.go","lineNumber":236,"sourceCode":"\tpostsCache.expire = time.Now().Add(postsCacheTTL)\n\tpostsCache.key = dataKey\n\n\treturn posts, nil\n}\n\nfunc (p *JsNoteClubPlugin) fetchDataKey(client *http.Client) (string, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), requestTimeout)\n\tdefer cancel()\n\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, \"https://jsnoteclub.com/\", nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"[%s] 创建首页请求失败: %w\", p.Name(), err)\n\t}\n\tsetHTMLHeaders(req, \"https://jsnoteclub.com/\")\n\n\tresp, err := p.doRequestWithRetry(req, client, maxRequestRetries)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"[%s] 访问首页失败: %w\", p.Name(), err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"[%s] 首页返回状态码: %d\", p.Name(), resp.StatusCode)\n\t}\n\n\tdoc, err := goquery.NewDocumentFromReader(resp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"[%s] 解析首页失败: %w\", p.Name(), err)\n\t}\n\n\tvar htmlBuilder strings.Builder\n\tdoc.Find(\"script\").Each(func(_ int, s *goquery.Selection) {\n\t\tif html, err := goquery.OuterHtml(s); err == nil {\n\t\t\thtmlBuilder.WriteString(html)\n\t\t}\n\t})","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/jsnoteclub/jsnoteclub.go#L218-L254","documentation":"Returned when p.doRequestWithRetry exhausts maxRequestRetries attempts to GET https://jsnoteclub.com/ without a usable response. The underlying transport error (DNS failure, TLS problem, timeout, connection refused) is wrapped via %w. All retry attempts already happened; this is the final failure.","triggerScenarios":"Every attempt of doRequestWithRetry fails: network unreachable, DNS resolution failure for jsnoteclub.com, TLS handshake error, or context deadline (requestTimeout) exceeded on each retry.","commonSituations":"The site is down or blocking the scraper's user agent/IP; corporate firewall or no internet access; DNS misconfiguration; requestTimeout set too low for slow networks; the site moved to a different domain (jsnoteclub.com is a small Chinese site whose uptime is not guaranteed).","solutions":["Run curl -v https://jsnoteclub.com/ from the same host to isolate DNS/TLS/network problems","Check the wrapped error for context deadline exceeded and consider increasing requestTimeout","Verify outbound internet access and proxy environment variables (HTTP_PROXY/HTTPS_PROXY)","Retry later — the upstream site may be temporarily down or rate-limiting your IP","Check whether setHTMLHeaders' User-Agent is being blocked and update headers"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"key, err := plugin.fetchDataKey(client)\nif err != nil {\n    if errors.Is(err, context.DeadlineExceeded) {\n        // timeouts: increase requestTimeout or back off and retry\n        return backoffAndRetry()\n    }\n    return fmt.Errorf(\"homepage unreachable, retry later: %w\", err)\n}","preventionTips":["Run curl -v against the site from the deployment host to verify reachability","Set requestTimeout generously (e.g. 30s) for slow upstreams","Honor HTTP(S)_PROXY settings in restricted networks","Add exponential backoff between the plugin's own retries and don't hammer the site"],"tags":["network","http","timeout","dns","retry-exhausted"],"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"}