{"record":{"id":"1781e4701a3715be","repo":"jackwener/OpenCLI","slug":"no-semantic-scholar-papers-matched-query","errorCode":null,"errorMessage":"No Semantic Scholar papers matched \"${query}\".","messagePattern":"No Semantic Scholar papers matched \"(.+?)\"\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"info","filePath":"clis/semanticscholar/search.js","lineNumber":43,"sourceCode":"    strategy: Strategy.PUBLIC,\n    browser: false,\n    args: [\n        { name: 'query', positional: true, required: true, help: 'Search text (e.g. \"attention is all you need\", \"diffusion model\")' },\n        { name: 'limit', type: 'int', default: 20, help: 'Max papers (1-100, single Semantic Scholar page)' },\n    ],\n    columns: ['rank', 'paperId', 'doi', 'title', 'year', 'firstAuthor', 'citationCount', 'url'],\n    func: async (args) => {\n        const query = requireString(args.query, 'query');\n        const limit = requireBoundedInt(args.limit, 20, 100);\n        const url = `${S2_GRAPH_BASE}/paper/search?query=${encodeURIComponent(query)}&limit=${limit}&fields=${FIELDS}`;\n        const body = await s2Fetch(url, 'semanticscholar search');\n\n        const data = Array.isArray(body?.data) ? body.data : null;\n        if (data === null) {\n            throw new CommandExecutionError('semanticscholar search returned an unexpected payload shape');\n        }\n        if (!data.length) {\n            throw new EmptyResultError('semanticscholar search', `No Semantic Scholar papers matched \"${query}\".`);\n        }\n\n        return data.slice(0, limit).map((p, i) => normalizePaperRow(p, 'search', { rank: i + 1 }));\n    },\n});\n","sourceCodeStart":25,"sourceCodeEnd":49,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/semanticscholar/search.js#L25-L49","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Simplify the query to 3-6 distinctive keywords (author surname + topic) and retry.","Check spelling and drop punctuation/quotes from the query.","If the paper may not be indexed, look it up by DOI or arXiv id instead: `opencli semanticscholar paper 10.xxxx/yyy`.","In scripts, catch EmptyResultError and treat it as a zero-row outcome rather than a crash."],"exampleFix":"// before\nopencli semanticscholar search \"Attention Is All You Need (NeurIPS 2017)\"\n// after\nopencli semanticscholar search \"attention is all you need\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    const rows = await searchPapers(query);\n} catch (err) {\n    if (err instanceof EmptyResultError) {\n    console.log(`No papers found for \"${query}\"; try broader keywords or a DOI/arXiv id.`);\n        return [];\n    }\n    throw err;\n}","preventionTips":["Prefer 3-6 distinctive keywords over full titles with punctuation.","Fall back to DOI/arXiv-id lookup when title search returns nothing.","In pipelines, treat EmptyResultError as a zero-row branch, not a crash.","Validate interpolated query variables are non-empty before calling."],"tags":["empty-results","search","api"],"backgroundTag":"empty-search-results","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}