fish2018/pansou · error

[ ] 人机验证会话失效

Error message

[%s] 人机验证会话失效

What it means

This error is returned by MiosouPlugin.searchImpl after its 2-attempt loop ends without a successful search: each attempt either hit an Anubis gate response (re-running ensureGate and retrying) or otherwise failed to complete. It signals that the anti-bot (Anubis) session could not be established or kept alive, so no search could be performed.

Solutions

  1. Verify ensureGate/completeAnubisChallenge still matches the site's current Anubis implementation (page structure, pass endpoint)
  2. Check that the http.Client cookie jar is preserved between requests so the cleared cookie persists
  3. Reduce request rate and avoid rotating IPs so the Anubis clearance is trusted
  4. Test manually in a browser: if the browser is also challenged endlessly, the account/IP is flagged — wait or change network

Example fix

// caller-side handling
results, err := plugin.Search(keyword, ext)
if err != nil && strings.Contains(err.Error(), "人机验证会话失效") {
    // gate session is unusable: wait and retry later, or alert for plugin update
    time.Sleep(10 * time.Minute)
}
Defensive patterns

Strategy: retry

Validate before calling

// Go: probe whether the gate is active before searching
resp, err := http.Get(baseURL + "/")
if err == nil {
    body, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
    resp.Body.Close()
    if isAnubisGateBody(body) {
        // gate is up: ensure challenge solving works before searching
    }
}

Type guard

func isGateSessionError(err error) bool {
    return err != nil && strings.Contains(err.Error(), "人机验证会话失效")
}

Try / catch

results, err := plugin.Search(keyword, nil)
if err != nil {
    if isGateSessionError(err) {
        log.Println("anti-bot session exhausted; backing off")
        time.Sleep(10 * time.Minute)
        return retryOnce()
    }
    return nil, err
}

Prevention

When it happens

Trigger: Both attempts of searchImpl's loop receive isAnubisGateResponse(resp) == true; ensureGate is re-run each time and the subsequent search still gets gated, exhausting the loop and falling through to the final return.

Common situations: The site hardened its Anubis challenge (higher difficulty or changed page structure so parseAnubisChallenge/completeAnubisChallenge silently mis-handles it); cookies from the cookie jar are rejected; the client IP is flagged and always re-challenged.

Related errors


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

Appendix: source

Thrown at plugin/miosou/miosou.go:130

			}
			continue
		}
		if resp.StatusCode != http.StatusOK {
			resp.Body.Close()
			cancel()
			return nil, fmt.Errorf("[%s] 搜索接口返回状态码: %d", p.Name(), resp.StatusCode)
		}
		groups, err := parseSearchStream(resp.Body)
		resp.Body.Close()
		if err != nil {
			cancel()
			return nil, fmt.Errorf("[%s] 解析搜索流失败: %w", p.Name(), err)
		}
		results := p.convertGroups(ctx, groups, keyword)
		cancel()
		return results, nil
	}
	return nil, fmt.Errorf("[%s] 人机验证会话失效", p.Name())
}

func (p *MiosouPlugin) ensureGate() error {
	p.gateMu.Lock()
	defer p.gateMu.Unlock()
	if p.gateReady {
		return nil
	}

	var lastErr error
	for attempt := 0; attempt < 3; attempt++ {
		ctx, cancel := context.WithTimeout(context.Background(), gateTimeout)
		err := p.completeAnubisChallenge(ctx)
		cancel()
		if err == nil {
			p.gateReady = true
			return nil
		}

View on GitHub (pinned to beaa561337)