{"record":{"id":"a58cb9914cdff8b0","repo":"jackwener/OpenCLI","slug":"imdb-search-results-did-not-finish-loading","errorCode":null,"errorMessage":"IMDb search results did not finish loading","messagePattern":"IMDb search results did not finish loading","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/imdb/search.js","lineNumber":35,"sourceCode":"        { name: 'limit', type: 'int', default: 20, help: 'Number of results' },\n    ],\n    columns: ['rank', 'id', 'title', 'year', 'type', 'url'],\n    func: async (page, args) => {\n        const query = String(args.query || '').trim();\n        // Reject empty or whitespace-only queries early\n        if (!query) {\n            throw new ArgumentError('Search query cannot be empty');\n        }\n        const limit = Math.max(1, Math.min(Number(args.limit) || 20, 50));\n        const url = forceEnglishUrl(`https://www.imdb.com/find/?q=${encodeURIComponent(query)}&ref_=nv_sr_sm`);\n        await page.goto(url);\n        const onSearchPage = await waitForImdbPath(page, '^/find/?$');\n        const searchReady = await waitForImdbSearchReady(page, 15000);\n        if (await isChallengePage(page)) {\n            throw new CommandExecutionError('IMDb blocked this request', 'Try again with a normal browser session or extension mode');\n        }\n        if (!onSearchPage || !searchReady) {\n            throw new CommandExecutionError('IMDb search results did not finish loading', 'Retry the command; if it persists, the search page structure may have changed');\n        }\n        const results = await page.evaluate(`\n      (function() {\n        var results = [];\n\n        function pushResult(item) {\n          if (!item || !item.id || !item.title) {\n            return;\n          }\n          results.push(item);\n        }\n\n        var nextDataEl = document.getElementById('__NEXT_DATA__');\n        if (nextDataEl) {\n          try {\n            var nextData = JSON.parse(nextDataEl.textContent || 'null');\n            var pageProps = nextData && nextData.props && nextData.props.pageProps;\n            if (pageProps) {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/imdb/search.js#L17-L53","documentation":"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.","triggerScenarios":"After goto of the IMDb find URL: waitForImdbPath(page, '^/find/?$') is false (redirected elsewhere) or waitForImdbSearchReady(page, 15000) times out while isChallengePage is false.","commonSituations":"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.","solutions":["Retry the command; transient load or slow network is the most common cause.","Increase patience/timeout options if the library exposes them, or run on a faster connection.","Check whether IMDb changed the /find/ page structure; the library may need an update.","Confirm you were not silently redirected (check the final URL) — if so, treat it as blocking/redirect behavior."],"exampleFix":"// before\nawait imdbSearch({ query: 'duyne' }); // flaky timeout on slow VPN\n// after\ntry {\n  await imdbSearch({ query: 'duyne' });\n} catch (e) {\n  if (String(e.message).includes('did not finish loading')) await retry(imdbSearch, { query: 'duyne' });\n  else throw e;\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await imdbSearch({ query });\n} catch (e) {\n  if (/did not finish loading/.test(e.message)) {\n    return retryWithBackoff(() => imdbSearch({ query }), { attempts: 2, baseDelay: 5000 });\n  }\n  throw e;\n}","preventionTips":["Retry transient load failures with exponential backoff before surfacing the error.","Run on a stable, fast network connection; avoid VPN/proxy latency for scraping.","Pin/keep the library updated in case IMDb changes its search page structure.","Distinguish blocking (challenge) from slow-load errors to choose the right response."],"tags":["timeout","page-load","network","scraping"],"backgroundTag":"page-load-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}