fish2018/pansou · error

Anubis 验证页返回状态码

Error message

Anubis 验证页返回状态码 %d

What it means

When the fetched page contains no parseable Anubis challenge, the code only tolerates a genuine non-gate HTTP 200 (miosou.go:177). Any other status — or a 200 that still looks like an Anubis gate (401 or /.within.website/ path) — yields this error naming the status code.

Solutions

  1. Retry later — 429/ban states usually clear; ensureGate's 3 retries may not be enough for rate limits.
  2. Check whether Anubis was upgraded and update anubisChallengePattern to match the new page markup.
  3. Verify the User-Agent/headers in setPageHeaders are not triggering bot rejection (403).
  4. Inspect the actual response body/status with curl to identify whether it's a block, a redirect, or a server error.
  5. If a proxy/CDN intercepts the request, bypass or configure it properly.
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Get(baseURL + "/")
if err == nil {
    if resp.StatusCode != http.StatusOK {
        // expect gate issues; probe body for Anubis markers before proceeding
    }
    resp.Body.Close()
}

Try / catch

if err := p.ensureGate(); err != nil {
    if strings.Contains(err.Error(), "验证页返回状态码") {
        // non-200 or still gated: back off (rate limit) or report server-side issue
    }
    return err
}

Prevention

When it happens

Trigger: GET baseURL+/ returns a non-200 status (401/403/429/5xx) or a 200 whose response isAnubisGateResponse (unauthorized or /.within.website/ URL) while the challenge JSON cannot be extracted from the body.

Common situations: Anubis rate-limiting or IP-banning the client, the site returning a maintenance/5xx page, Anubis upgrading its page format so the regex no longer matches, or a CDN serving an error page.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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

Appendix: source

Thrown at plugin/miosou/miosou.go:177

	setPageHeaders(req)
	resp, err := p.client.Do(req)
	if err != nil {
		return fmt.Errorf("获取 Anubis 验证题目失败: %w", err)
	}
	body, readErr := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
	resp.Body.Close()
	if readErr != nil {
		return fmt.Errorf("读取 Anubis 验证题目失败: %w", readErr)
	}
	challenge, found, err := parseAnubisChallenge(body)
	if err != nil {
		return err
	}
	if !found {
		if resp.StatusCode == http.StatusOK && !isAnubisGateResponse(resp) {
			return nil
		}
		return fmt.Errorf("Anubis 验证页返回状态码 %d", resp.StatusCode)
	}

	startedAt := time.Now()
	hash, nonce, err := solveAnubisChallenge(ctx, challenge.Challenge.RandomData, challenge.Rules.Difficulty)
	if err != nil {
		return err
	}
	elapsed := time.Since(startedAt).Milliseconds()
	if elapsed < 1 {
		elapsed = 1
	}
	query := url.Values{
		"id":          []string{challenge.Challenge.ID},
		"response":    []string{hash},
		"nonce":       []string{strconv.FormatUint(nonce, 10)},
		"redir":       []string{baseURL + "/"},
		"elapsedTime": []string{strconv.FormatInt(elapsed, 10)},
	}

View on GitHub (pinned to beaa561337)