{"record":{"id":"8a0a46f04744a406","repo":"fish2018/pansou","slug":"w-8a0a46","errorCode":null,"errorMessage":"读取下载链接响应失败: %w","messagePattern":"读取下载链接响应失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/cyg/cyg.go","lineNumber":252,"sourceCode":"\t// 设置请求头\n\tp.setRequestHeaders(req)\n\n\t// 发送请求\n\tresp, err := p.doRequestWithRetry(req, client)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"下载链接请求失败: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// 检查状态码\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"下载链接请求状态码: %d\", resp.StatusCode)\n\t}\n\n\t// 解析响应\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"读取下载链接响应失败: %w\", err)\n\t}\n\n\tvar downloadData []CygDownload\n\tif err := json.Unmarshal(body, &downloadData); err != nil {\n\t\treturn nil, fmt.Errorf(\"下载链接JSON解析失败: %w\", err)\n\t}\n\n\t// 转换为model.Link格式\n\treturn p.convertToLinks(downloadData), nil\n}\n\n// convertToSearchResult 转换为标准搜索结果格式\nfunc (p *CygPlugin) convertToSearchResult(post CygPost, links []model.Link) model.SearchResult {\n\treturn model.SearchResult{\n\t\tUniqueID: fmt.Sprintf(\"cyg-%d\", post.ID),\n\t\tTitle:    p.cleanHTML(post.Title.Rendered),\n\t\tContent:  p.cleanHTML(post.Excerpt.Rendered),\n\t\tDatetime: p.parseDateTime(post.Date),","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/cyg/cyg.go#L234-L270","documentation":"Wrapped I/O error in cyg plugin's getDownloadLinks (plugin/cyg/cyg.go:252): reading the body of the download-link HTTP response failed after a 200 status was received (connection reset, timeout, truncated body, etc.). The request itself succeeded, so this indicates a transport-level failure while consuming the response, not a bad URL or non-200 status.","triggerScenarios":"The server closes the connection prematurely while sending the download-links JSON body (unexpected EOF, connection reset by peer, chunked-encoding truncation).","commonSituations":"远端服务器响应缓慢导致读取超时；代理/网络抖动中断长响应传输。","solutions":["Simply retry the request; this is usually transient — the plugin already retries the request itself, so check why retries also fail.","Check proxy/VPN interference and try a direct connection.","Verify the server is not truncating responses due to load (curl the endpoint repeatedly).","If persistent, wrap the read with an io.LimitReader and tolerate partial failures, or increase client robustness (keep-alives disabled)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"var links []model.Link\nvar err error\nfor i := 0; i < 3; i++ {\n    links, err = p.getDownloadLinks(id)\n    if err == nil || !errors.Is(err, io.ErrUnexpectedEOF) {\n        break\n    }\n    time.Sleep(time.Duration(i+1) * time.Second)\n}","preventionTips":["Retry once or twice automatically; truncated bodies are usually transient.","Avoid long-lived proxied connections when fetching large JSON bodies.","Keep the HTTP client's defaults sane (no aggressive idle-conn killing)."],"tags":["network","io","go","http-body"],"backgroundTag":"file-read-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"}