fish2018/pansou · error

读取验证响应失败

Error message

读取验证响应失败: %w

What it means

Wraps the error from ioutil.ReadAll when reading the body of the challenge-verification response. The HTTP response arrived but its body could not be fully read (connection reset mid-body, chunked read failure).

Solutions

  1. Retry the whole challenge flow; this is typically transient.
  2. Inspect the wrapped cause for 'connection reset'/'unexpected EOF' and check proxy stability.
  3. Reduce timeouts/idle settings so the client closes connections before the server does.
  4. Capture resp.StatusCode and headers when it fails to diagnose where the connection died.
Defensive patterns

Strategy: retry

Try / catch

if err != nil { if errors.Is(err, io.ErrUnexpectedEOF) || errors.Is(err, syscall.ECONNRESET) { retryWithBackoff() }; return err }

Prevention

When it happens

Trigger: submitChallengeVerification got a successful POST but ioutil.ReadAll(resp.Body) returned err, before any body parsing.

Common situations: Server or middlebox closing the connection early during large challenge pages, keep-alive sockets dropped by proxies, gzip/transfer corruption.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at plugin/gying/gying.go:1880

	}

	return p.submitChallengeVerification(scraper, requestURL, form)
}

func (p *GyingPlugin) submitChallengeVerification(scraper *cloudscraper.Scraper, requestURL string, form url.Values) error {
	resp, err := scraper.Post(requestURL, "application/x-www-form-urlencoded", strings.NewReader(form.Encode()))
	if err != nil {
		return fmt.Errorf("提交验证失败: %w", err)
	}
	defer resp.Body.Close()

	if DebugLog {
		fmt.Printf("[Gying] Challenge提交完成: url=%s status=%d\n", requestURL, resp.StatusCode)
	}

	respBody, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return fmt.Errorf("读取验证响应失败: %w", err)
	}
	if isBotChallengePage(respBody) {
		return fmt.Errorf("机器人验证出现循环")
	}

	var verifyResp challengeVerifyResponse
	if err := json.Unmarshal(respBody, &verifyResp); err != nil {
		return fmt.Errorf("解析验证响应失败: %w", err)
	}
	if !verifyResp.Success {
		if verifyResp.Msg != "" {
			return fmt.Errorf("机器人验证失败: %s", verifyResp.Msg)
		}
		return fmt.Errorf("机器人验证失败")
	}

	if DebugLog {
		fmt.Printf("[Gying] Challenge验证成功: url=%s\n", requestURL)

View on GitHub (pinned to beaa561337)