jackwener/OpenCLI · error · CommandExecutionError

Title page did not finish loading: ${id}

Error message

Title page did not finish loading: ${id}

What it means

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.

Source

Thrown at clis/imdb/title.js:28

    access: 'read',
    description: 'Get movie or TV show details',
    domain: 'www.imdb.com',
    strategy: Strategy.PUBLIC,
    browser: true,
    args: [
        { name: 'id', positional: true, required: true, help: 'IMDb title ID (tt1375666) or URL' },
    ],
    columns: ['field', 'value'],
    func: async (page, args) => {
        const id = normalizeImdbId(String(args.id), 'tt');
        const url = forceEnglishUrl(`https://www.imdb.com/title/${id}/`);
        await page.goto(url);
        const onTitlePage = await waitForImdbPath(page, `^/title/${id}/`);
        if (await isChallengePage(page)) {
            throw new CommandExecutionError('IMDb blocked this request', 'Try again with a normal browser session or extension mode');
        }
        if (!onTitlePage) {
            throw new CommandExecutionError(`Title page did not finish loading: ${id}`, 'Retry the command; if it persists, IMDb may have changed their navigation flow');
        }
        const currentId = await getCurrentImdbId(page, 'tt');
        if (currentId && currentId !== id) {
            throw new CommandExecutionError(`IMDb redirected to a different title: ${currentId}`, 'Retry the command; if it persists, the title page may have changed');
        }
        // Single browser roundtrip: fetch title JSON-LD by type whitelist
        const titleTypes = ['Movie', 'TVSeries', 'TVEpisode', 'TVMiniseries', 'TVMovie', 'TVSpecial', 'VideoGame', 'ShortFilm'];
        const ld = await extractJsonLd(page, titleTypes);
        if (!ld) {
            throw new CommandExecutionError(`Title not found: ${id}`, 'Check the title ID and try again');
        }
        const data = ld;
        const type = String(data['@type'] || '');
        const isTvSeries = type === 'TVSeries' || type === 'TVMiniseries';
        // Handle both array and single-object JSON-LD person fields
        const toPeople = (arr) => {
            if (!arr)
                return '';

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the command; transient navigation timing is the most common cause.
  2. Verify the title ID is a valid, currently-resolvable tt ID.
  3. Check whether IMDb changed its title URL structure; the library may need an update.
  4. Ensure no consent/region interstitial is intercepting navigation (try the extension/normal browser mode).

Example fix

// before
await imdbTitle({ id: 'tt9999999' }); // dead id, page never lands
// after
const id = 'tt0111161'; // verified resolvable id
await imdbTitle({ id });
Defensive patterns

Strategy: retry

Validate before calling

if (!/^tt\d{7,8}$/.test(id)) throw new Error(`invalid IMDb title id: ${id}`);

Type guard

function isValidTitleId(id) {
  return typeof id === 'string' && /^tt\d{7,8}$/.test(id);
}

Try / catch

try {
  return await imdbTitle({ id });
} catch (e) {
  if (new RegExp(`Title page did not finish loading: ${id}`).test(e.message)) {
    return retryWithBackoff(() => imdbTitle({ id }), { attempts: 2 });
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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