{"record":{"id":"bcc6484b15d180f5","repo":"fish2018/pansou","slug":"d-w-bcc648","errorCode":null,"errorMessage":"重试 %d 次后仍然失败: %w","messagePattern":"重试 (.+?) 次后仍然失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/aikanzy/aikanzy.go","lineNumber":592,"sourceCode":"\t\t\t// 指数退避\n\t\t\tbackoffTime := time.Duration(1<<uint(retry-1)) * backoffBase * time.Millisecond\n\t\t\ttime.Sleep(backoffTime)\n\t\t\t\n\t\t\t// 克隆请求\n\t\t\treq = req.Clone(req.Context())\n\t\t}\n\t\t\n\t\tresp, err = client.Do(req)\n\t\tif err == nil && resp.StatusCode == 200 {\n\t\t\treturn resp, nil\n\t\t}\n\t\t\n\t\tif resp != nil {\n\t\t\tresp.Body.Close()\n\t\t}\n\t}\n\t\n\treturn nil, fmt.Errorf(\"重试 %d 次后仍然失败: %w\", maxRetries, err)\n}\n","sourceCodeStart":574,"sourceCodeEnd":594,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/aikanzy/aikanzy.go#L574-L594","documentation":"This error is returned by doRequestWithRetry in the aikanzy plugin after all HTTP request attempts to the aikanzy site have failed. It wraps the last underlying error (via %w) so the real cause — timeout, DNS failure, connection reset, non-retryable client error, etc. — is preserved. It signals that even after maxRetries attempts with backoff, no successful response was obtained.","triggerScenarios":"Any caller of doRequestWithRetry (doSearch, fetchDetailPageLinks) exhausts maxRetries because the site is unreachable, times out, refuses connections, or returns errors the retry loop does not tolerate on every attempt.","commonSituations":"The aikanzy site is down or blocked from the deployment network; DNS resolution fails; the per-request context deadline expires; the site rate-limits or returns 4xx/5xx on every attempt; a proxy/firewall drops the connections.","solutions":["Inspect the wrapped cause with errors.Unwrap / %v of the error and fix that root problem (timeout vs DNS vs status code).","Verify network egress to the target site (curl the URL from the same host, check proxy env vars HTTP_PROXY/HTTPS_PROXY).","Increase maxRetries or retry backoff in doRequestWithRetry if failures are transient (rate limiting, occasional 5xx).","Raise the request context timeout if errors are context deadline exceeded.","Check whether the site changed its URL/blocked scrapers; update the base URL or headers if so."],"exampleFix":"// before\nresults, err := p.doSearch(keyword)\n// after\nresults, err := p.doSearch(keyword)\nif errors.Is(err, context.DeadlineExceeded) {\n    // extend per-attempt timeout or reduce result scope and retry\n}\nif err != nil {\n    log.Printf(\"aikanzy unavailable, continuing with other plugins: %v\", err)\n}","handlingStrategy":"retry","validationCode":"// Pre-check reachability before invoking the plugin\nresp, err := http.Head(\"https://aikanzy.example.com\")\nif err != nil {\n    log.Printf(\"aikanzy unreachable, skipping: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"// Go: inspect the wrapped cause and degrade gracefully\nresults, err := plugin.Search(keyword, ext)\nif err != nil {\n    var ctxErr error\n    if errors.Is(err, context.DeadlineExceeded) {\n        ctxErr = fmt.Errorf(\"aikanzy timed out: %w\", err)\n    }\n    log.Printf(\"skipping aikanzy results: %v\", err)\n    results = nil // continue with other plugins\n}","preventionTips":["Monitor site reachability and alert before retries start failing consistently.","Keep per-request timeouts comfortably above worst-case latency.","Cap retry storms: increase backoff instead of only increasing retry count.","Respect rate limits to avoid getting blocked and burning all retries."],"tags":["network","http","retry","go"],"backgroundTag":"api-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"}