jackwener/OpenCLI · warning · EmptyResultError

reuters search

Error message

reuters search

What it means

EmptyResultError with source 'reuters search'. The search executed successfully and the JSON body parsed, but mapSearchArticles produced zero rows for the query — i.e. Reuters legitimately returned no matching articles. This is a no-data signal, not a failure of the request pipeline.

Source

Thrown at clis/reuters/search.js:59

                `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

  1. Broaden the query — shorter terms, fewer words, or alternate spellings (as the error message itself suggests).
  2. Try a known-popular keyword (e.g. 'markets') to confirm the pipeline works and the issue is the query.
  3. If even broad queries return nothing, verify mapSearchArticles against the current Reuters response format in clis/reuters/utils.js.
  4. Check Reuters search in a regular browser for the same query to confirm there are genuinely no results.

Example fix

// before
const rows = await cli.run('reuters search', { query: 'Q3 lithium carbonate futures arbitrage Belgium' });
// after
const rows = await cli.run('reuters search', { query: 'lithium' });
Defensive patterns

Strategy: fallback

Validate before calling

// sanity-check the query before invoking
const q = String(query || '').trim();
if (q.length < 3) throw new Error('Query too narrow/short for Reuters search — broaden it first');

Type guard

function hasRows(rows) { return Array.isArray(rows) && rows.length > 0; }

Try / catch

try {
  rows = await cli.run('reuters search', { query });
} catch (e) {
  if (e instanceof EmptyResultError || e.name === 'EmptyResultError') {
    rows = []; // or fall back to a broader query
  } else throw e;
}

Prevention

When it happens

Trigger: result.body parsed fine but contained no articles mappable by mapSearchArticles(body, limit) — an overly specific query, unusual filters, or a response shape whose article list sits at a different key.

Common situations: Very narrow queries (rare names, long phrases); misspelled search terms; limit parsing fine but zero hits; a Reuters API response-format change causing the mapper to find no articles even when they exist.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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