jackwener/OpenCLI · error · CommandExecutionError

Sogou Weixin blocked this search request

Error message

Sogou Weixin blocked this search request

What it means

Thrown when the extraction payload reports `blocked: true`, meaning Sogou Weixin served an anti-bot verification (captcha/slider) page instead of search results. The library refuses to scrape around the challenge and asks the user to verify manually in Chrome. This is an access/rate-limit condition, not a code bug.

Source

Thrown at clis/weixin/search.js:126

        const limit = normalizeLimit(kwargs.limit);
        const searchUrl = buildSearchUrl(query, pageNo);

        let payload;
        try {
            await page.goto(searchUrl);
            await page.wait(2);
            payload = await page.evaluate(buildExtractSearchResultsEvaluate());
        }
        catch (error) {
            const detail = error instanceof Error ? error.message : String(error);
            throw new CommandExecutionError('weixin search failed while loading Sogou results', detail);
        }

        if (!payload || typeof payload !== 'object' || !Array.isArray(payload.rows)) {
            throw new CommandExecutionError('weixin search returned an unreadable browser payload', 'Sogou Weixin may have changed its result page structure.');
        }
        if (payload.blocked) {
            throw new CommandExecutionError('Sogou Weixin blocked this search request', 'Open weixin.sogou.com in Chrome and complete any verification before retrying.');
        }
        if (payload.invalidCount > 0) {
            throw new CommandExecutionError('Sogou Weixin returned article cards without required title or URL', 'The result page structure may have changed; refusing to return a partial result set.');
        }

        const rows = payload.rows;
        if (rows.length === 0 && payload.empty) {
            throw new EmptyResultError('weixin search', 'Try a different keyword or a different page number.');
        }
        if (rows.length === 0) {
            throw new CommandExecutionError('weixin search did not expose article result cards', 'Sogou Weixin may have changed its selectors or returned a transient shell page.');
        }

        return rows.slice(0, limit).map((row, index) => ({
            rank: (pageNo - 1) * 10 + index + 1,
            page: pageNo,
            title: row.title,
            url: row.url,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open weixin.sogou.com in a regular Chrome window and complete the verification (captcha/slider), then retry
  2. Wait a few minutes to cool down before retrying
  3. Slow down: add delays between searches and reduce request volume in batch scripts
  4. Switch to a residential/less-flagged IP or disable the VPN
  5. Use fresh browser cookies/profile if the old one is marked suspicious

Example fix

// before: tight loop
for (const q of queries) await search(q);
// after: throttle and detect blocks
for (const q of queries) {
  const r = await search(q).catch(e => ({ blocked: String(e).includes('blocked') }));
  if (r.blocked) { await sleep(5 * 60_000); continue; }
  await sleep(3_000);
}
Defensive patterns

Strategy: retry

Try / catch

try { rows = await weixinSearch(q); }
catch (e) {
  if (String(e.message).includes('blocked')) { await sleep(5 * 60_000); return retryOnce(); }
  throw e;
}

Prevention

When it happens

Trigger: Too many rapid searches from the same IP/cookie; the automated browser session triggers Sogou's risk control; a shared/VPN/datacenter IP is flagged; reusing a session cookie that Sogou has invalidated.

Common situations: Batch/loop scripts issuing many consecutive searches; running from cloud or VPN IPs that Sogou distrusts; first run from a new network; searching during periods of stricter anti-bot enforcement.

Related errors


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