jackwener/OpenCLI · info · EmptyResultError

No Semantic Scholar papers matched "${query}".

Error message

No Semantic Scholar papers matched "${query}".

What it means

An EmptyResultError thrown when the Semantic Scholar search succeeded (valid `data` array) but returned zero papers for the query. This is a normal 'nothing found' signal, not a failure: the CLI surfaces it as an empty result so scripts can distinguish no-matches from hard errors. Empty results are expected for very specific, misspelled, or over-filtered queries.

Source

Thrown at clis/semanticscholar/search.js:43

    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'query', positional: true, required: true, help: 'Search text (e.g. "attention is all you need", "diffusion model")' },
        { name: 'limit', type: 'int', default: 20, help: 'Max papers (1-100, single Semantic Scholar page)' },
    ],
    columns: ['rank', 'paperId', 'doi', 'title', 'year', 'firstAuthor', 'citationCount', 'url'],
    func: async (args) => {
        const query = requireString(args.query, 'query');
        const limit = requireBoundedInt(args.limit, 20, 100);
        const url = `${S2_GRAPH_BASE}/paper/search?query=${encodeURIComponent(query)}&limit=${limit}&fields=${FIELDS}`;
        const body = await s2Fetch(url, 'semanticscholar search');

        const data = Array.isArray(body?.data) ? body.data : null;
        if (data === null) {
            throw new CommandExecutionError('semanticscholar search returned an unexpected payload shape');
        }
        if (!data.length) {
            throw new EmptyResultError('semanticscholar search', `No Semantic Scholar papers matched "${query}".`);
        }

        return data.slice(0, limit).map((p, i) => normalizePaperRow(p, 'search', { rank: i + 1 }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Simplify the query to 3-6 distinctive keywords (author surname + topic) and retry.
  2. Check spelling and drop punctuation/quotes from the query.
  3. If the paper may not be indexed, look it up by DOI or arXiv id instead: `opencli semanticscholar paper 10.xxxx/yyy`.
  4. In scripts, catch EmptyResultError and treat it as a zero-row outcome rather than a crash.

Example fix

// before
opencli semanticscholar search "Attention Is All You Need (NeurIPS 2017)"
// after
opencli semanticscholar search "attention is all you need"
Defensive patterns

Strategy: try-catch

Try / catch

try {
    const rows = await searchPapers(query);
} catch (err) {
    if (err instanceof EmptyResultError) {
    console.log(`No papers found for "${query}"; try broader keywords or a DOI/arXiv id.`);
        return [];
    }
    throw err;
}

Prevention

When it happens

Trigger: Calling `opencli semanticscholar search "<query>"` where the query matches no papers: misspelled titles, overly specific multi-word queries, quotes/special characters that break matching, or fields/limit params narrowing results to none.

Common situations: Typing a full paper title with punctuation instead of keywords; searching for preprints not indexed by Semantic Scholar; scripted pipelines where an upstream variable interpolated an empty or wrong query string.

Related errors


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