{"record":{"id":"44039596523af16d","repo":"fish2018/pansou","slug":"s-440395","errorCode":null,"errorMessage":"[%s] 人机验证会话失效","messagePattern":"\\[(.+?)\\] 人机验证会话失效","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/miosou/miosou.go","lineNumber":130,"sourceCode":"\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\tresp.Body.Close()\n\t\t\tcancel()\n\t\t\treturn nil, fmt.Errorf(\"[%s] 搜索接口返回状态码: %d\", p.Name(), resp.StatusCode)\n\t\t}\n\t\tgroups, err := parseSearchStream(resp.Body)\n\t\tresp.Body.Close()\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t\treturn nil, fmt.Errorf(\"[%s] 解析搜索流失败: %w\", p.Name(), err)\n\t\t}\n\t\tresults := p.convertGroups(ctx, groups, keyword)\n\t\tcancel()\n\t\treturn results, nil\n\t}\n\treturn nil, fmt.Errorf(\"[%s] 人机验证会话失效\", p.Name())\n}\n\nfunc (p *MiosouPlugin) ensureGate() error {\n\tp.gateMu.Lock()\n\tdefer p.gateMu.Unlock()\n\tif p.gateReady {\n\t\treturn nil\n\t}\n\n\tvar lastErr error\n\tfor attempt := 0; attempt < 3; attempt++ {\n\t\tctx, cancel := context.WithTimeout(context.Background(), gateTimeout)\n\t\terr := p.completeAnubisChallenge(ctx)\n\t\tcancel()\n\t\tif err == nil {\n\t\t\tp.gateReady = true\n\t\t\treturn nil\n\t\t}","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/miosou/miosou.go#L112-L148","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify ensureGate/completeAnubisChallenge still matches the site's current Anubis implementation (page structure, pass endpoint)","Check that the http.Client cookie jar is preserved between requests so the cleared cookie persists","Reduce request rate and avoid rotating IPs so the Anubis clearance is trusted","Test manually in a browser: if the browser is also challenged endlessly, the account/IP is flagged — wait or change network"],"exampleFix":"// caller-side handling\nresults, err := plugin.Search(keyword, ext)\nif err != nil && strings.Contains(err.Error(), \"人机验证会话失效\") {\n    // gate session is unusable: wait and retry later, or alert for plugin update\n    time.Sleep(10 * time.Minute)\n}","handlingStrategy":"retry","validationCode":"// Go: probe whether the gate is active before searching\nresp, err := http.Get(baseURL + \"/\")\nif err == nil {\n    body, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20))\n    resp.Body.Close()\n    if isAnubisGateBody(body) {\n        // gate is up: ensure challenge solving works before searching\n    }\n}","typeGuard":"func isGateSessionError(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"人机验证会话失效\")\n}","tryCatchPattern":"results, err := plugin.Search(keyword, nil)\nif err != nil {\n    if isGateSessionError(err) {\n        log.Println(\"anti-bot session exhausted; backing off\")\n        time.Sleep(10 * time.Minute)\n        return retryOnce()\n    }\n    return nil, err\n}","preventionTips":["Keep the plugin's Anubis implementation in sync with the site's version","Persist cookies across searches so clearance is reused","Avoid IP rotation mid-session","Back off exponentially after gate failures"],"tags":["anti-bot","anubis","challenge","upstream"],"backgroundTag":"captcha-challenge-failed","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"}