jackwener/OpenCLI · error · CommandExecutionError

IMDb blocked this request

Error message

IMDb blocked this request

What it means

The imdb search command throws CommandExecutionError('IMDb blocked this request') when, after navigating to the IMDb /find/ URL, the page is detected as a bot-challenge page via isChallengePage(page). IMDb serves CAPTCHA or anti-bot interstitials instead of search results. The hint suggests retrying with a normal browser session or extension mode.

Source

Thrown at clis/imdb/search.js:32

    browser: true,
    args: [
        { name: 'query', positional: true, required: true, help: 'Search query' },
        { name: 'limit', type: 'int', default: 20, help: 'Number of results' },
    ],
    columns: ['rank', 'id', 'title', 'year', 'type', 'url'],
    func: async (page, args) => {
        const query = String(args.query || '').trim();
        // Reject empty or whitespace-only queries early
        if (!query) {
            throw new ArgumentError('Search query cannot be empty');
        }
        const limit = Math.max(1, Math.min(Number(args.limit) || 20, 50));
        const url = forceEnglishUrl(`https://www.imdb.com/find/?q=${encodeURIComponent(query)}&ref_=nv_sr_sm`);
        await page.goto(url);
        const onSearchPage = await waitForImdbPath(page, '^/find/?$');
        const searchReady = await waitForImdbSearchReady(page, 15000);
        if (await isChallengePage(page)) {
            throw new CommandExecutionError('IMDb blocked this request', 'Try again with a normal browser session or extension mode');
        }
        if (!onSearchPage || !searchReady) {
            throw new CommandExecutionError('IMDb search results did not finish loading', 'Retry the command; if it persists, the search page structure may have changed');
        }
        const results = await page.evaluate(`
      (function() {
        var results = [];

        function pushResult(item) {
          if (!item || !item.id || !item.title) {
            return;
          }
          results.push(item);
        }

        var nextDataEl = document.getElementById('__NEXT_DATA__');
        if (nextDataEl) {
          try {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry later or from a different network/residential IP.
  2. Run with the extension-based / normal browser session mode so real cookies and fingerprint are used.
  3. Reduce request frequency and add delays between commands to avoid rate limiting.
  4. Clear browser state/cookies that may be flagged, or log in to IMDb in the controlled browser.

Example fix

// before
await imdbSearch({ query: 'inception' }); // fired in tight loop, got blocked
// after
await sleep(3000); // back off between requests
await imdbSearch({ query: 'inception', mode: 'extension' });
Defensive patterns

Strategy: retry

Try / catch

try {
  return await imdbSearch({ query });
} catch (e) {
  if (/IMDb blocked this request/.test(e.message)) {
    await sleep(30_000);
    return retryWithBackoff(() => imdbSearch({ query, mode: 'extension' }), { attempts: 3 });
  }
  throw e;
}

Prevention

When it happens

Trigger: page.goto of the IMDb find URL followed by waitForImdbPath and waitForImdbSearchReady succeed navigation-wise, but isChallengePage(page) returns true because IMDb presented a challenge/captcha page.

Common situations: Running from datacenter IPs or CI, heavy scripted usage triggering rate limiting, headless browser fingerprint detection, or cookies/session flagged by IMDb anti-bot protection.

Related errors


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