jackwener/OpenCLI · error · CommandExecutionError

IMDb search results did not finish loading

Error message

IMDb search results did not finish loading

What it means

The imdb search command throws this CommandExecutionError when either the URL did not land on the /find/ path (waitForImdbPath returned false) or waitForImdbSearchReady did not report the search results ready within 15000 ms. It fires only after the challenge-page check passes, meaning the page loaded but search results never rendered.

Source

Thrown at clis/imdb/search.js:35

        { 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 {
            var nextData = JSON.parse(nextDataEl.textContent || 'null');
            var pageProps = nextData && nextData.props && nextData.props.pageProps;
            if (pageProps) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the command; transient load or slow network is the most common cause.
  2. Increase patience/timeout options if the library exposes them, or run on a faster connection.
  3. Check whether IMDb changed the /find/ page structure; the library may need an update.
  4. Confirm you were not silently redirected (check the final URL) — if so, treat it as blocking/redirect behavior.

Example fix

// before
await imdbSearch({ query: 'duyne' }); // flaky timeout on slow VPN
// after
try {
  await imdbSearch({ query: 'duyne' });
} catch (e) {
  if (String(e.message).includes('did not finish loading')) await retry(imdbSearch, { query: 'duyne' });
  else throw e;
}
Defensive patterns

Strategy: retry

Try / catch

try {
  return await imdbSearch({ query });
} catch (e) {
  if (/did not finish loading/.test(e.message)) {
    return retryWithBackoff(() => imdbSearch({ query }), { attempts: 2, baseDelay: 5000 });
  }
  throw e;
}

Prevention

When it happens

Trigger: After goto of the IMDb find URL: waitForImdbPath(page, '^/find/?$') is false (redirected elsewhere) or waitForImdbSearchReady(page, 15000) times out while isChallengePage is false.

Common situations: Slow network exceeding the 15s timeout, IMDb A/B testing or redesign changing the search page structure, a soft redirect away from /find/, or heavy client-side rendering delaying results.

Related errors


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