jackwener/OpenCLI · error · CommandExecutionError

Xianyu returned a verification page or blocked the current b

Error message

Xianyu returned a verification page or blocked the current browser session

What it means

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.

Source

Thrown at clis/xianyu/search.js:228

        const limit = normalizeLimit(kwargs.limit);
        const minPrice = parsePriceArg(kwargs['min-price'], 'min-price');
        const maxPrice = parsePriceArg(kwargs['max-price'], 'max-price');
        if (minPrice != null && maxPrice != null && minPrice > maxPrice) {
            throw new ArgumentError('xianyu search min-price cannot be greater than max-price', `Received --min-price ${minPrice} and --max-price ${maxPrice}`);
        }
        const province = String(kwargs.province || '').trim();
        const city = String(kwargs.city || '').trim();
        const searchFilter = buildSearchFilter(minPrice, maxPrice);
        const extraFilterValue = buildExtraFilterValue(province, city);
        const fromFilter = Boolean(searchFilter) || extraFilterValue !== '{}';
        await page.goto(buildSearchUrl(query));
        await page.wait(2);
        const result = await page.evaluate(buildSearchEvaluate({ keyword: query, searchFilter, extraFilterValue, fromFilter, maxItems: limit }));
        if (result?.error === 'auth-required') {
            throw new AuthRequiredError('www.goofish.com', 'Xianyu search requires a logged-in browser session');
        }
        if (result?.error === 'blocked') {
            throw new CommandExecutionError('Xianyu returned a verification page or blocked the current browser session');
        }
        if (result?.error === 'mtop-not-ready') {
            throw selectorError('window.lib.mtop', '闲鱼页面未完成初始化,无法调用搜索接口');
        }
        if (!result || typeof result !== 'object') {
            throw new CommandExecutionError('Xianyu search returned a malformed response');
        }
        const errorCode = String(result?.error_code || '');
        const errorMessage = String(result?.error_message || '');
        if (/FAIL_SYS_SESSION_EXPIRED|SESSION_EXPIRED|FAIL_SYS_TOKEN/.test(errorCode) || /FAIL_SYS_SESSION_EXPIRED|SESSION_EXPIRED/.test(errorMessage)) {
            throw new AuthRequiredError('www.goofish.com', 'Xianyu search requires a logged-in browser session');
        }
        if (result?.error) {
            throw new CommandExecutionError(errorMessage || `Xianyu search request failed: ${result.error}`);
        }
        if (!Array.isArray(result.items)) {
            throw new CommandExecutionError('Xianyu search response did not include an items array');
        }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Wait and retry later with a lower request frequency
  2. Complete any verification (captcha/slider) manually in the managed browser window, then retry
  3. Use a warmer, regularly-used browser profile rather than a fresh/headless one
  4. Change network/IP if the current one is heavily rate-limited
Defensive patterns

Strategy: retry

Try / catch

try { await xianyuSearch(args); } catch (e) { if (e instanceof CommandExecutionError && /verification page|blocked/.test(e.message)) { await backoff(delay); return xianyuSearch(args); } throw e; }

Prevention

When it happens

Trigger: 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'.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/c6fec3378c0ffb86. Report an issue: GitHub.