jackwener/OpenCLI · warning · EmptyResultError

No papers found. Try a different keyword.

Error message

No papers found. Try a different keyword.

What it means

An EmptyResultError thrown when the arXiv relevance-sorted search (all:<query>) parses to zero entries, meaning no papers matched the keywords. arXiv returns an empty feed rather than an error for non-matching queries, so the library surfaces this as an expected empty result with a hint to try different keywords.

Source

Thrown at clis/arxiv/search.js:26

    description: 'Search arXiv papers',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'query', positional: true, required: true, help: 'Search keyword (e.g. "attention is all you need")' },
        { name: 'limit', type: 'int', default: 10, help: 'Max results (max 25)' },
    ],
    columns: ['id', 'title', 'authors', 'published', 'primary_category', 'url'],
    func: async (args) => {
        const queryText = String(args.query || '').trim();
        if (!queryText) {
            throw new ArgumentError('arxiv search query cannot be empty');
        }
        const limit = normalizeArxivLimit(args.limit, 10, 25);
        const query = encodeURIComponent(`all:${queryText}`);
        const xml = await arxivFetch(`search_query=${query}&max_results=${limit}&sortBy=relevance`);
        const entries = parseEntries(xml);
        if (!entries.length)
            throw new EmptyResultError('arxiv', 'No papers found. Try a different keyword.');
        return entries.map(e => ({
            id: e.id,
            title: e.title,
            authors: e.authors,
            published: e.published,
            primary_category: e.primary_category,
            url: e.url,
        }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Shorten the query to 1-3 core keywords and re-run
  2. Try synonyms or standard arXiv terminology
  3. Use `opencli arxiv author "<name>"` instead if searching by author
  4. Check spelling and avoid special characters/punctuation in the query

Example fix

// before
await exec('opencli arxiv search "a very long natural language question about transformers"');
// after
const keywords = query.split(/\s+/).slice(0, 3).join(' ');
await exec(`opencli arxiv search "${keywords}"`); // "transformers attention"
Defensive patterns

Strategy: fallback

Validate before calling

const query = String(userQuery || '').trim();
if (!query) throw new Error('search query required');

Type guard

null

Try / catch

try {
  return await exec(`opencli arxiv search "${query}"`);
} catch (e) {
  if (e.name === 'EmptyResultError') {
    const shortened = query.split(/\s+/).slice(0, 2).join(' ');
    if (shortened && shortened !== query) {
      return await exec(`opencli arxiv search "${shortened}"`); // retry with fewer keywords
    }
    return [];
  }
  throw e;
}

Prevention

When it happens

Trigger: `opencli arxiv search "<terms>"` where the all: field query matches nothing — overly specific multi-word phrases, obscure terminology, or searching for non-paper content.

Common situations: Searching full sentences instead of keywords; jargon not used in arXiv metadata; searching for author names (better served by `arxiv author`); limiting fields the all: index does not cover well.

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/acb1b2a1398f9195. Report an issue: GitHub.