{"record":{"id":"2318586b6eeeaa3d","repo":"jackwener/OpenCLI","slug":"title-page-did-not-finish-loading-id","errorCode":null,"errorMessage":"Title page did not finish loading: ${id}","messagePattern":"Title page did not finish loading: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/imdb/title.js","lineNumber":28,"sourceCode":"    access: 'read',\n    description: 'Get movie or TV show details',\n    domain: 'www.imdb.com',\n    strategy: Strategy.PUBLIC,\n    browser: true,\n    args: [\n        { name: 'id', positional: true, required: true, help: 'IMDb title ID (tt1375666) or URL' },\n    ],\n    columns: ['field', 'value'],\n    func: async (page, args) => {\n        const id = normalizeImdbId(String(args.id), 'tt');\n        const url = forceEnglishUrl(`https://www.imdb.com/title/${id}/`);\n        await page.goto(url);\n        const onTitlePage = await waitForImdbPath(page, `^/title/${id}/`);\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 (!onTitlePage) {\n            throw new CommandExecutionError(`Title page did not finish loading: ${id}`, 'Retry the command; if it persists, IMDb may have changed their navigation flow');\n        }\n        const currentId = await getCurrentImdbId(page, 'tt');\n        if (currentId && currentId !== id) {\n            throw new CommandExecutionError(`IMDb redirected to a different title: ${currentId}`, 'Retry the command; if it persists, the title page may have changed');\n        }\n        // Single browser roundtrip: fetch title JSON-LD by type whitelist\n        const titleTypes = ['Movie', 'TVSeries', 'TVEpisode', 'TVMiniseries', 'TVMovie', 'TVSpecial', 'VideoGame', 'ShortFilm'];\n        const ld = await extractJsonLd(page, titleTypes);\n        if (!ld) {\n            throw new CommandExecutionError(`Title not found: ${id}`, 'Check the title ID and try again');\n        }\n        const data = ld;\n        const type = String(data['@type'] || '');\n        const isTvSeries = type === 'TVSeries' || type === 'TVMiniseries';\n        // Handle both array and single-object JSON-LD person fields\n        const toPeople = (arr) => {\n            if (!arr)\n                return '';","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/imdb/title.js#L10-L46","documentation":"The imdb title command throws this CommandExecutionError when waitForImdbPath(page, '^/title/<id>/') returns false, meaning the browser never ended up on the expected title URL path after navigation, even though no challenge page was shown. The library cannot proceed to extract data from a page that is not the requested title page.","triggerScenarios":"After page.goto of https://www.imdb.com/title/<id>/ and passing the isChallengePage check, waitForImdbPath for `^/title/${id}/` resolves false — e.g. the URL redirected or the SPA never settled on the expected path.","commonSituations":"IMDb redesign changing URL patterns, SPA routing delays, being softly redirected to a regional/consent page, or a malformed ID passing normalization but not resolving.","solutions":["Retry the command; transient navigation timing is the most common cause.","Verify the title ID is a valid, currently-resolvable tt ID.","Check whether IMDb changed its title URL structure; the library may need an update.","Ensure no consent/region interstitial is intercepting navigation (try the extension/normal browser mode)."],"exampleFix":"// before\nawait imdbTitle({ id: 'tt9999999' }); // dead id, page never lands\n// after\nconst id = 'tt0111161'; // verified resolvable id\nawait imdbTitle({ id });","handlingStrategy":"retry","validationCode":"if (!/^tt\\d{7,8}$/.test(id)) throw new Error(`invalid IMDb title id: ${id}`);","typeGuard":"function isValidTitleId(id) {\n  return typeof id === 'string' && /^tt\\d{7,8}$/.test(id);\n}","tryCatchPattern":"try {\n  return await imdbTitle({ id });\n} catch (e) {\n  if (new RegExp(`Title page did not finish loading: ${id}`).test(e.message)) {\n    return retryWithBackoff(() => imdbTitle({ id }), { attempts: 2 });\n  }\n  throw e;\n}","preventionTips":["Validate title IDs against /^tt\\d{7,8}$/ before calling.","Retry once or twice on transient navigation failures.","Keep the library updated for IMDb URL/routing changes.","Watch for silent redirects to consent/region pages when using proxies."],"tags":["navigation","page-load","scraping","timeout"],"backgroundTag":"page-load-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}