jackwener/OpenCLI · error · AuthRequiredError

www.reuters.com

Error message

www.reuters.com

What it means

AuthRequiredError carrying the domain 'www.reuters.com'. The library detects an auth wall via isAuthStatus(result.status) (401/403-style statuses) or looksAuthWallText(result.textPreview) (challenge/login text in the page). Reuters sits behind Datadome anti-bot protection, so an unauthenticated or challenged browser session cannot call the search API. The error tells the user to provide an accessible Reuters browser session or complete human verification.

Source

Thrown at clis/reuters/search.js:39

    ],
    columns: ['rank', 'title', 'date', 'section', 'section_path', 'authors', 'url'],
    func: async (page, kwargs) => {
        const limit = parseLimit(kwargs.limit);
        const query = String(kwargs.query || '').trim();
        if (!query) {
            throw new ArgumentError('Search query cannot be empty', 'Provide a non-empty keyword');
        }
        await page.goto('https://www.reuters.com');
        await page.wait(2);
        const result = await page.evaluate(buildSearchScript(query, limit));
        if (result?.error) {
            throw new CommandExecutionError(`Reuters search failed inside the page: ${result.error}`);
        }
        if (!result || typeof result !== 'object') {
            throw new CommandExecutionError('Reuters search API returned an unreadable response');
        }
        if (isAuthStatus(result.status) || looksAuthWallText(result.textPreview)) {
            throw new AuthRequiredError(
                'www.reuters.com',
                `Reuters search requires an accessible Reuters browser session or completed human verification${result.status ? ` (HTTP ${result.status})` : ''}`,
            );
        }
        if (result.ok !== true) {
            const status = Number.isFinite(result.status) && result.status > 0
                ? `HTTP ${result.status}${result.statusText ? ` ${result.statusText}` : ''}`
                : 'no upstream response';
            throw new CommandExecutionError(`Reuters search API failed (${status})`);
        }
        if (!result.body) {
            const detail = result.parseError ? `: ${result.parseError}` : '';
            throw new CommandExecutionError(
                `Reuters search returned a non-JSON body${detail}`,
                'Open www.reuters.com in your browser and clear any challenge before retrying.',
            );
        }
        const rows = mapSearchArticles(result.body, limit);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open www.reuters.com in the browser session, complete any Datadome/human-verification challenge, then re-run the search.
  2. Log in to Reuters in the controlled browser so fresh session cookies exist (Strategy.COOKIE).
  3. Refresh/re-export cookies from a browser where reuters.com is fully accessible.
  4. Retry later or from a different network/IP if Datadome is flagging your IP.

Example fix

// before: headless session with no cookies
const rows = await cli.run('reuters search', { query: 'oil' });
// after: authenticate first
await cli.run('browser open', { url: 'https://www.reuters.com' }); // complete challenge/login
const rows = await cli.run('reuters search', { query: 'oil' });
Defensive patterns

Strategy: try-catch

Validate before calling

// verify session accessibility before searching
const probe = await page.evaluate(() => document.body.innerText.slice(0, 500));
if (/verify you are human|robot|access denied/i.test(probe)) {
  throw new Error('Complete the Reuters challenge in the browser session first');
}

Type guard

function isAuthWall(status, textPreview) {
  return [401, 403, 429].includes(Number(status)) ||
    /datadome|captcha|verify you are human|are you a robot/i.test(textPreview || '');
}

Try / catch

try {
  const rows = await cli.run('reuters search', { query });
} catch (e) {
  if (e instanceof AuthRequiredError || e.name === 'AuthRequiredError') {
    await openBrowserAndCompleteChallenge('https://www.reuters.com');
    const rows = await cli.run('reuters search', { query });
  } else throw e;
}

Prevention

When it happens

Trigger: The in-page fetch of articles-by-search-v2 returns an HTTP auth status (e.g. 401/403), or the page text preview matches Datadome/login-wall markers, while running in a Strategy.COOKIE session without a valid reuters.com session.

Common situations: Expired or missing Reuters cookies; first run from a new IP/datacenter triggering Datadome; cookies copied from a different browser profile; Reuters rotating challenge requirements after a site update.

Related errors


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