{"record":{"id":"08f302861c3c1a9a","repo":"jackwener/OpenCLI","slug":"www-reuters-com-08f302","errorCode":null,"errorMessage":"www.reuters.com","messagePattern":"www\\.reuters\\.com","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/reuters/search.js","lineNumber":39,"sourceCode":"    ],\n    columns: ['rank', 'title', 'date', 'section', 'section_path', 'authors', 'url'],\n    func: async (page, kwargs) => {\n        const limit = parseLimit(kwargs.limit);\n        const query = String(kwargs.query || '').trim();\n        if (!query) {\n            throw new ArgumentError('Search query cannot be empty', 'Provide a non-empty keyword');\n        }\n        await page.goto('https://www.reuters.com');\n        await page.wait(2);\n        const result = await page.evaluate(buildSearchScript(query, limit));\n        if (result?.error) {\n            throw new CommandExecutionError(`Reuters search failed inside the page: ${result.error}`);\n        }\n        if (!result || typeof result !== 'object') {\n            throw new CommandExecutionError('Reuters search API returned an unreadable response');\n        }\n        if (isAuthStatus(result.status) || looksAuthWallText(result.textPreview)) {\n            throw new AuthRequiredError(\n                'www.reuters.com',\n                `Reuters search requires an accessible Reuters browser session or completed human verification${result.status ? ` (HTTP ${result.status})` : ''}`,\n            );\n        }\n        if (result.ok !== true) {\n            const status = Number.isFinite(result.status) && result.status > 0\n                ? `HTTP ${result.status}${result.statusText ? ` ${result.statusText}` : ''}`\n                : 'no upstream response';\n            throw new CommandExecutionError(`Reuters search API failed (${status})`);\n        }\n        if (!result.body) {\n            const detail = result.parseError ? `: ${result.parseError}` : '';\n            throw new CommandExecutionError(\n                `Reuters search returned a non-JSON body${detail}`,\n                'Open www.reuters.com in your browser and clear any challenge before retrying.',\n            );\n        }\n        const rows = mapSearchArticles(result.body, limit);","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/reuters/search.js#L21-L57","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open www.reuters.com in the browser session, complete any Datadome/human-verification challenge, then re-run the search.","Log in to Reuters in the controlled browser so fresh session cookies exist (Strategy.COOKIE).","Refresh/re-export cookies from a browser where reuters.com is fully accessible.","Retry later or from a different network/IP if Datadome is flagging your IP."],"exampleFix":"// before: headless session with no cookies\nconst rows = await cli.run('reuters search', { query: 'oil' });\n// after: authenticate first\nawait cli.run('browser open', { url: 'https://www.reuters.com' }); // complete challenge/login\nconst rows = await cli.run('reuters search', { query: 'oil' });","handlingStrategy":"try-catch","validationCode":"// verify session accessibility before searching\nconst probe = await page.evaluate(() => document.body.innerText.slice(0, 500));\nif (/verify you are human|robot|access denied/i.test(probe)) {\n  throw new Error('Complete the Reuters challenge in the browser session first');\n}","typeGuard":"function isAuthWall(status, textPreview) {\n  return [401, 403, 429].includes(Number(status)) ||\n    /datadome|captcha|verify you are human|are you a robot/i.test(textPreview || '');\n}","tryCatchPattern":"try {\n  const rows = await cli.run('reuters search', { query });\n} catch (e) {\n  if (e instanceof AuthRequiredError || e.name === 'AuthRequiredError') {\n    await openBrowserAndCompleteChallenge('https://www.reuters.com');\n    const rows = await cli.run('reuters search', { query });\n  } else throw e;\n}","preventionTips":["Keep fresh Reuters session cookies in the controlled browser profile.","Complete Datadome challenges interactively as soon as they appear.","Avoid running from datacenter IPs that Datadome flags; warm up the session with a normal page visit first.","Re-authenticate when cookies expire rather than retrying blind."],"tags":["auth","anti-bot","cookies","network"],"backgroundTag":"auth-wall-challenge-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}