{"record":{"id":"304e9ef3dbce79db","repo":"fish2018/pansou","slug":"s-failed-to-read-response-on-page-d-w","errorCode":null,"errorMessage":"[%s] failed to read response on page %d: %w","messagePattern":"\\[(.+?)\\] failed to read response on page (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/panzun/panzun.go","lineNumber":144,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"[%s] search request failed on page %d: %w\", p.Name(), page, err)\n\t\t}\n\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\tresp.Body.Close()\n\t\t\tif len(allResults) > 0 {\n\t\t\t\tfmt.Printf(\"[%s] Warning: unexpected status code %d on page %d\\n\", p.Name(), resp.StatusCode, page)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"[%s] unexpected status code: %d on page %d\", p.Name(), resp.StatusCode, page)\n\t\t}\n\n\t\tbody, err := io.ReadAll(resp.Body)\n\t\tresp.Body.Close()\n\t\tif err != nil {\n\t\t\tif len(allResults) > 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"[%s] failed to read response on page %d: %w\", p.Name(), page, err)\n\t\t}\n\n\t\tvar searchResp SearchResponse\n\t\tif err := jsonutil.Unmarshal(body, &searchResp); err != nil {\n\t\t\tif len(allResults) > 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"[%s] failed to parse response on page %d: %w\", p.Name(), page, err)\n\t\t}\n\n\t\tpageResults, err := p.convertDiscussionsToResults(client, searchResp.Data)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"[%s] Warning: detail parse failed on page %d: %v\\n\", p.Name(), page, err)\n\t\t}\n\n\t\tfor _, result := range pageResults {\n\t\t\tif result.UniqueID == \"\" || seenIDs[result.UniqueID] {\n\t\t\t\tcontinue","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/panzun/panzun.go#L126-L162","documentation":"Wrapped read error in panzun's searchImpl (plugin/panzun/panzun.go:144): the 200 response on a given page could not be fully read. If earlier pages already produced results the loop breaks (partial results kept); otherwise this error is returned, meaning the whole search failed on the first page read.","triggerScenarios":"The connection drops or times out mid-body transfer (chunked/incomplete response) while reading the panzun.cc discussions API response on the first page.","commonSituations":"翻页较深时连接被服务端断开；响应体过大超时。","solutions":["Retry the request — transient read failures usually succeed on a second attempt","Increase the HTTP client/read timeout","Check for proxies or firewalls truncating responses","Rely on partial-results semantics (later pages already break gracefully)"],"exampleFix":"// before\nreturn nil, fmt.Errorf(\"[%s] failed to read response on page %d: %w\", p.Name(), page, err)\n// after\nif len(allResults) == 0 && retryCount < maxRetries {\n    return p.searchImplRetry(client, keyword, ext, retryCount+1)\n}\nreturn nil, fmt.Errorf(\"[%s] failed to read response on page %d: %w\", p.Name(), page, err)","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"results, err := plugin.Search(keyword, ext)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to read response\") {\n        // transient I/O error — retry once before giving up\n    }\n}","preventionTips":["Retry transient mid-body read failures","Increase read timeouts on slow upstreams","Check proxies/firewalls that truncate long responses"],"tags":["go","network","http","io","plugin"],"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"}