jackwener/OpenCLI · error · CommandExecutionError

Reuters article-detail failed inside the page: ${result.erro

Error message

Reuters article-detail failed inside the page: ${result.error}

What it means

The command throws CommandExecutionError when the in-page scraping script invoked via buildArticleDetailScript returns { error } — i.e. the injected browser-side extraction failed. This isolates failures inside the rendered page (selectors missing, script exception) from navigation failures.

Source

Thrown at clis/reuters/article-detail.js:36

    domain: 'www.reuters.com',
    strategy: Strategy.COOKIE,
    args: [
        { name: 'url', required: true, positional: true, help: 'Reuters article URL (must be on reuters.com)' },
    ],
    columns: ['title', 'date', 'section', 'section_path', 'authors', 'description', 'word_count', 'url', 'body'],
    func: async (page, kwargs) => {
        const url = String(kwargs.url || '').trim();
        if (!url) {
            throw new ArgumentError('Article URL cannot be empty');
        }
        if (!REUTERS_HOST.test(url)) {
            throw new ArgumentError(`URL must be on reuters.com, got ${url}`);
        }
        await page.goto(url);
        await page.wait(2);
        const result = await page.evaluate(buildArticleDetailScript());
        if (result?.error) {
            throw new CommandExecutionError(`Reuters article-detail failed inside the page: ${result.error}`);
        }
        if (result?.authRequired) {
            throw new AuthRequiredError('www.reuters.com', 'Reuters article-detail is gated by login, subscription, or human verification');
        }
        if (!result || result.ok !== true) {
            throw new CommandExecutionError(
                'Reuters article-detail returned no payload',
                'Check that the URL points to a Reuters article and that the page loaded',
            );
        }
        const detail = mapArticleDetail(result.body?.article, result.body?.bodyText, url);
        if (!detail || (!detail.title && !detail.body)) {
            throw new EmptyResultError('reuters article-detail', 'Page rendered no article body — likely paywalled or a non-article URL');
        }
        return [detail];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry — transient interstitials often clear on a second load
  2. Verify the URL is a real article page, not a section or profile page
  3. Update the tool / report a bug if Reuters changed their page structure
  4. Check for bot-detection/consent pages and use an authenticated session if needed
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try {
  await reutersArticleDetail(url);
} catch (e) {
  if (String(e.message).startsWith('Reuters article-detail failed inside the page')) {
    // in-page scrape failure: retry once, then report as likely markup change
    return await retryOnce(url);
  }
  throw e;
}

Prevention

When it happens

Trigger: page.evaluate runs the detail script but it returns result.error truthy — typically because the loaded page lacks expected Reuters DOM structure or an in-page exception occurred while parsing article JSON/DOM.

Common situations: Reuters changed its page markup/JSON schema; a consent or bot-check page rendered instead of the article; the URL points to a non-article reuters.com page (section page, author profile) whose structure the script cannot parse.

Related errors


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