{"record":{"id":"c0f58047ee11226b","repo":"fish2018/pansou","slug":"quarkres-read-response-failed-w","errorCode":null,"errorMessage":"[quarkres] read response failed: %w","messagePattern":"\\[quarkres\\] read response failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/quarkres/quarkres.go","lineNumber":105,"sourceCode":"\treq.Header.Set(\"User-Agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36\")\n\treq.Header.Set(\"Accept\", \"application/json, text/plain, */*\")\n\treq.Header.Set(\"Accept-Language\", \"zh-CN,zh;q=0.9\")\n\treq.Header.Set(\"Connection\", \"keep-alive\")\n\treq.Header.Set(\"Referer\", \"https://squark.cc.cd/\")\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[quarkres] request failed: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"[quarkres] HTTP %d\", resp.StatusCode)\n\t}\n\n\tbodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[quarkres] read response failed: %w\", err)\n\t}\n\n\tvar ar apiResp\n\tif err := json.Unmarshal(bodyBytes, &ar); err != nil {\n\t\treturn nil, fmt.Errorf(\"[quarkres] decode response failed: %w\", err)\n\t}\n\n\tif ar.Code != 200 {\n\t\treturn nil, fmt.Errorf(\"[quarkres] API error: %s\", ar.Message)\n\t}\n\n\tresults := make([]model.SearchResult, 0, len(ar.Data))\n\tfor _, item := range ar.Data {\n\t\tlinks := make([]model.Link, 0, len(item.Links))\n\t\tfor _, l := range item.Links {\n\t\t\t// 只保留夸克链接（本源只有夸克）\n\t\t\tif strings.Contains(l.URL, \"pan.quark.cn\") {\n\t\t\t\tlinks = append(links, model.Link{","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/quarkres/quarkres.go#L87-L123","documentation":"Raised in doSearch when io.ReadAll fails while reading the quarkres API response body after a 200 status. Typical triggers: the connection to squark.cc.cd drops mid-body, a proxy resets the stream, or the read exceeds the client's timeout — the request itself succeeded but the payload could not be fully received.","triggerScenarios":"Thrown at plugin/quarkres/quarkres.go:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["延长客户端读取超时","对读取失败做单次重试","检查网络中间层是否截断响应"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}