fish2018/pansou · error

[quarkres] read response failed

Error message

[quarkres] read response failed: %w

What it means

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.

Solutions

  1. 延长客户端读取超时
  2. 对读取失败做单次重试
  3. 检查网络中间层是否截断响应
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at plugin/quarkres/quarkres.go:105 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07). Data as JSON: /api/errors/c0f58047ee11226b. Report an issue: GitHub.

Appendix: source

Thrown at plugin/quarkres/quarkres.go:105

	req.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")
	req.Header.Set("Accept", "application/json, text/plain, */*")
	req.Header.Set("Accept-Language", "zh-CN,zh;q=0.9")
	req.Header.Set("Connection", "keep-alive")
	req.Header.Set("Referer", "https://squark.cc.cd/")

	resp, err := client.Do(req)
	if err != nil {
		return nil, fmt.Errorf("[quarkres] request failed: %w", err)
	}
	defer resp.Body.Close()

	if resp.StatusCode != 200 {
		return nil, fmt.Errorf("[quarkres] HTTP %d", resp.StatusCode)
	}

	bodyBytes, err := io.ReadAll(resp.Body)
	if err != nil {
		return nil, fmt.Errorf("[quarkres] read response failed: %w", err)
	}

	var ar apiResp
	if err := json.Unmarshal(bodyBytes, &ar); err != nil {
		return nil, fmt.Errorf("[quarkres] decode response failed: %w", err)
	}

	if ar.Code != 200 {
		return nil, fmt.Errorf("[quarkres] API error: %s", ar.Message)
	}

	results := make([]model.SearchResult, 0, len(ar.Data))
	for _, item := range ar.Data {
		links := make([]model.Link, 0, len(item.Links))
		for _, l := range item.Links {
			// 只保留夸克链接(本源只有夸克)
			if strings.Contains(l.URL, "pan.quark.cn") {
				links = append(links, model.Link{

View on GitHub (pinned to beaa561337)