{"record":{"id":"a29720ced3cc1d47","repo":"fish2018/pansou","slug":"read-response-failed-w","errorCode":null,"errorMessage":"read response failed: %w","messagePattern":"read response failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/discourse/discourse.go","lineNumber":489,"sourceCode":"\t// 构建详情URL\n\tdetailURL := fmt.Sprintf(detailURLTemplate, topicID)\n\n\t// 发送详情请求\n\tresp, err := p.scraper.Get(detailURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"detail request failed: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// 检查HTTP状态码\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"unexpected status code: %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(\"read response failed: %w\", err)\n\t}\n\n\t// 解析JSON响应\n\tvar detailResp DetailResponse\n\tif err := json.Unmarshal(body, &detailResp); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse json failed: %w\", err)\n\t}\n\n\t// 提取第一个帖子的链接\n\tif len(detailResp.PostStream.Posts) == 0 {\n\t\treturn nil, fmt.Errorf(\"no posts found\")\n\t}\n\n\tmainPost := detailResp.PostStream.Posts[0]\n\t\n\t// 从 link_counts 中提取网盘链接\n\tvar links []model.Link\n\tfor _, linkCount := range mainPost.LinkCounts {","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/discourse/discourse.go#L471-L507","documentation":"Wrapped I/O error in GetTopicDetail (plugin/discourse/discourse.go:489): the topic detail response arrived with HTTP 200 but its body could not be fully read (connection dropped mid-transfer, timeout). The JSON was never parsed, so the failure is transport-level.","triggerScenarios":"io.ReadAll(resp.Body) fails after a successful detail request — connection dropped mid-body, truncated chunked encoding, timeout during read.","commonSituations":"服务端提前关闭连接；响应体过大超过读取时限。","solutions":["Retry the detail request; the cause is usually transient","Check network/proxy stability","Increase the HTTP client timeout if large responses are truncated"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"links, err := plugin.GetTopicDetail(id)\nif err != nil && strings.Contains(err.Error(), \"read response failed\") {\n    time.Sleep(time.Second)\n    links, err = plugin.GetTopicDetail(id)\n}","preventionTips":["Allow adequate read timeouts for large topics","Retry transient IO errors once","Check proxy stability"],"tags":["network","io","http","discourse"],"backgroundTag":"network-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"}