jackwener/OpenCLI · error · CommandExecutionError
Reuters search API failed (${status})
Error message
Reuters search API failed (${status}) What it means
CommandExecutionError thrown when the in-page fetch completed but result.ok !== true, meaning the Reuters search API answered with a non-success response (or no upstream response at all). The message embeds 'HTTP <status>[ <statusText>]' when a status is available, or 'no upstream response' when the request never reached a server (network failure, blocked request, abort).
Source
Thrown at clis/reuters/search.js:48
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);
if (!rows.length) {
throw new EmptyResultError('reuters search', `No articles matched "${query}". Try broadening the query.`);
}
return rows;
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the command — transient 5xx or rate limiting often clears on retry (add a delay to avoid 429).
- Check the reported HTTP status: 429 means slow down; 404 suggests Reuters changed the API path and the injected script needs updating.
- Complete the Datadome challenge / refresh the session if the block is anti-bot related.
- Verify network connectivity in the browser session (the 'no upstream response' case).
Example fix
// before: immediate retry hammering a 429
for (const q of queries) await cli.run('reuters search', { query: q });
// after: backoff on failure
try {
const rows = await cli.run('reuters search', { query: q });
} catch (e) {
if (/HTTP 429/.test(e.message)) await sleep(30000);
} Defensive patterns
Strategy: retry
Validate before calling
// check reachability of the endpoint surface before batch calls
const res = await page.evaluate(() => fetch(location.origin, { method: 'HEAD' }).then(r => r.status).catch(() => 0));
if (!res) throw new Error('No upstream connectivity from the browser session'); Type guard
function hasUpstreamFailure(result) {
return typeof result === 'object' && result !== null && result.ok !== true &&
(typeof result.status !== 'number' || result.status >= 400);
} Try / catch
try {
const rows = await cli.run('reuters search', { query });
} catch (e) {
const m = e.message.match(/HTTP (\d+)/);
if (!m) throw e;
const status = Number(m[1]);
if (status === 429 || status >= 500) {
await sleep(30_000);
return cli.run('reuters search', { query });
}
throw e;
} Prevention
- Rate-limit batch searches; back off on 429.
- Monitor Reuters status/incidents for 5xx windows.
- Keep buildSearchScript in sync with the current articles-by-search-v2 endpoint path.
- Confirm browser-session network access before large jobs.
When it happens
Trigger: result.ok is false because the articles-by-search-v2 fetch returned 4xx/5xx, was blocked by Datadome at the network layer, or the fetch rejected so no upstream response exists.
Common situations: Reuters API returning 5xx during incidents; rate limiting (429); Datadome blocking the request server-side; temporary network outage inside the browser tab; Reuters changing the endpoint path so it 404s.
Related errors
- 12306 queryByTrainNo returned non-JSON body
- 12306 ${endpoint} returned non-JSON body
- 1point3acres request failed: HTTP ${res.status} ${res.status
- ${label} returned HTTP ${resp.status}: ${summarizeApiError(p
- archive snapshots failed: HTTP ${resp.status}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/5a1102de8713afb1.
Report an issue: GitHub.