{"record":{"id":"c6fec3378c0ffb86","repo":"jackwener/OpenCLI","slug":"xianyu-returned-a-verification-page-or-blocked-the","errorCode":null,"errorMessage":"Xianyu returned a verification page or blocked the current browser session","messagePattern":"Xianyu returned a verification page or blocked the current browser session","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/xianyu/search.js","lineNumber":228,"sourceCode":"        const limit = normalizeLimit(kwargs.limit);\n        const minPrice = parsePriceArg(kwargs['min-price'], 'min-price');\n        const maxPrice = parsePriceArg(kwargs['max-price'], 'max-price');\n        if (minPrice != null && maxPrice != null && minPrice > maxPrice) {\n            throw new ArgumentError('xianyu search min-price cannot be greater than max-price', `Received --min-price ${minPrice} and --max-price ${maxPrice}`);\n        }\n        const province = String(kwargs.province || '').trim();\n        const city = String(kwargs.city || '').trim();\n        const searchFilter = buildSearchFilter(minPrice, maxPrice);\n        const extraFilterValue = buildExtraFilterValue(province, city);\n        const fromFilter = Boolean(searchFilter) || extraFilterValue !== '{}';\n        await page.goto(buildSearchUrl(query));\n        await page.wait(2);\n        const result = await page.evaluate(buildSearchEvaluate({ keyword: query, searchFilter, extraFilterValue, fromFilter, maxItems: limit }));\n        if (result?.error === 'auth-required') {\n            throw new AuthRequiredError('www.goofish.com', 'Xianyu search requires a logged-in browser session');\n        }\n        if (result?.error === 'blocked') {\n            throw new CommandExecutionError('Xianyu returned a verification page or blocked the current browser session');\n        }\n        if (result?.error === 'mtop-not-ready') {\n            throw selectorError('window.lib.mtop', '闲鱼页面未完成初始化，无法调用搜索接口');\n        }\n        if (!result || typeof result !== 'object') {\n            throw new CommandExecutionError('Xianyu search returned a malformed response');\n        }\n        const errorCode = String(result?.error_code || '');\n        const errorMessage = String(result?.error_message || '');\n        if (/FAIL_SYS_SESSION_EXPIRED|SESSION_EXPIRED|FAIL_SYS_TOKEN/.test(errorCode) || /FAIL_SYS_SESSION_EXPIRED|SESSION_EXPIRED/.test(errorMessage)) {\n            throw new AuthRequiredError('www.goofish.com', 'Xianyu search requires a logged-in browser session');\n        }\n        if (result?.error) {\n            throw new CommandExecutionError(errorMessage || `Xianyu search request failed: ${result.error}`);\n        }\n        if (!Array.isArray(result.items)) {\n            throw new CommandExecutionError('Xianyu search response did not include an items array');\n        }","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xianyu/search.js#L210-L246","documentation":"When the in-page search script detects a verification (captcha/slider) page or an anti-bot block instead of the normal Goofish page, it returns error 'blocked' and the CLI throws a CommandExecutionError. This is Xianyu's risk control rejecting the automated browser.","triggerScenarios":"The page.goto of the search URL lands on a captcha/slider verification page, or the mtop call is intercepted and returns a block response detected as result.error === 'blocked'.","commonSituations":"Too-frequent automated searches from one session/IP, running in a headless or fingerprint-flagged browser, fresh profiles with no browsing history triggering stricter risk checks.","solutions":["Wait and retry later with a lower request frequency","Complete any verification (captcha/slider) manually in the managed browser window, then retry","Use a warmer, regularly-used browser profile rather than a fresh/headless one","Change network/IP if the current one is heavily rate-limited"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await xianyuSearch(args); } catch (e) { if (e instanceof CommandExecutionError && /verification page|blocked/.test(e.message)) { await backoff(delay); return xianyuSearch(args); } throw e; }","preventionTips":["Throttle search frequency to stay below Xianyu's risk-control thresholds","Use a warmed, regularly-used browser profile instead of fresh/headless ones","Complete captcha/verification prompts manually when they appear, then retry"],"tags":["anti-bot","rate-limit","verification","browser"],"backgroundTag":"anti-bot-blocked","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}