jackwener/OpenCLI · error · CommandExecutionError
Could not find chart data on page
Error message
Could not find chart data on page
What it means
The imdb top command throws CommandExecutionError('Could not find chart data on page') when extractJsonLd(page, 'ItemList') returns null or the result lacks an array itemListElement. The Top 250 chart page loaded without a challenge, but the expected ItemList JSON-LD block holding the chart entries is missing or malformed.
Source
Thrown at clis/imdb/top.js:29
description: 'IMDb Top 250 Movies',
domain: 'www.imdb.com',
strategy: Strategy.PUBLIC,
browser: true,
args: [
{ name: 'limit', type: 'int', default: 20, help: 'Number of results' },
],
columns: ['rank', 'title', 'rating', 'votes', 'genre', 'url'],
func: async (page, args) => {
const url = forceEnglishUrl('https://www.imdb.com/chart/top/');
await page.goto(url);
await page.wait(2);
if (await isChallengePage(page)) {
throw new CommandExecutionError('IMDb blocked this request', 'Try again with a normal browser session or extension mode');
}
// Extract the ItemList JSON-LD block which contains all chart entries
const ld = await extractJsonLd(page, 'ItemList');
if (!ld || !Array.isArray(ld.itemListElement)) {
throw new CommandExecutionError('Could not find chart data on page', 'IMDb may have changed their page structure');
}
const limit = Math.max(1, Math.min(Number(args.limit) || 20, 250));
const items = ld.itemListElement.slice(0, limit);
return items.map((entry, index) => {
const item = entry.item || {};
const rating = item.aggregateRating || {};
const genre = Array.isArray(item.genre)
? item.genre.join(', ')
: String(item.genre || '');
// Normalize relative URLs to absolute IMDb URLs
let itemUrl = item.url || '';
if (itemUrl && !/^https?:\/\//.test(itemUrl)) {
itemUrl = 'https://www.imdb.com' + itemUrl;
}
return {
rank: entry.position || index + 1,
title: String(item.name || ''),
rating: rating.ratingValue != null ? String(rating.ratingValue) : '',View on GitHub (pinned to 49907e53dc)
Solutions
- Retry the command — a slow render can leave JSON-LD missing after the fixed 2s wait.
- Increase the wait time before extraction if the library allows configuration.
- Check imdb.com/chart/top/ in a browser; if the structure changed, the library needs an update.
Example fix
// before
const top = await imdbTop({ limit: 10 }); // threw: chart data missing
// after
await sleep(1000); // give SPA more time, then retry once
const top = await retry(() => imdbTop({ limit: 10 }), { attempts: 2 }); Defensive patterns
Strategy: retry
Try / catch
try {
return await imdbTop({ limit });
} catch (e) {
if (/Could not find chart data/.test(e.message)) {
await sleep(5000);
return retryWithBackoff(() => imdbTop({ limit }), { attempts: 2 });
}
throw e;
} Prevention
- Retry once after a short delay — JSON-LD may render after the fixed 2s wait.
- Keep the library updated; IMDb chart redesigns can break ItemList extraction.
- Manually inspect imdb.com/chart/top/ source when errors start occurring consistently.
- Cache chart data to minimize exposure to transient rendering issues.
When it happens
Trigger: After a successful, non-challenged load of https://www.imdb.com/chart/top/ and page.wait(2), extractJsonLd(page, 'ItemList') yields no object, or ld.itemListElement is not an Array.
Common situations: IMDb redesigning the chart page and dropping/moving the ItemList JSON-LD, a partial render where JSON-LD hasn't been injected after only a 2-second wait, or a regional variant of the page with different markup.
Related errors
- Title not found: ${id}
- Could not find chart data on page
- ${label} did not include a stable numeric id.
- ${label} did not include a stable text value.
- Ctrip train page did not render train cards (state=${String(
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/4bc480dab62d928c.
Report an issue: GitHub.