{"record":{"id":"31443bc1e30b075d","repo":"jackwener/OpenCLI","slug":"no-semantic-scholar-recommendations-for-args-id","errorCode":null,"errorMessage":"No Semantic Scholar recommendations for \"${args.id}\".","messagePattern":"No Semantic Scholar recommendations for \"(.+?)\"\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"info","filePath":"clis/semanticscholar/recommendations.js","lineNumber":42,"sourceCode":"    strategy: Strategy.PUBLIC,\n    browser: false,\n    args: [\n        { name: 'id', positional: true, required: true, help: 'paperId (40-char hex), DOI, arXiv id, or prefixed id' },\n        { name: 'limit', type: 'int', default: 10, help: 'Max recommendations (1-500)' },\n    ],\n    columns: ['rank', 'paperId', 'doi', 'title', 'year', 'firstAuthor', 'citationCount', 'url'],\n    func: async (args) => {\n        const ref = requirePaperRef(args.id);\n        const limit = requireBoundedInt(args.limit, 10, 500);\n        const url = `${S2_REC_BASE}/papers/forpaper/${encodeURIComponent(ref)}?fields=${FIELDS}&limit=${limit}`;\n        const body = await s2Fetch(url, 'semanticscholar recommendations');\n\n        const recommended = Array.isArray(body?.recommendedPapers) ? body.recommendedPapers : null;\n        if (recommended === null) {\n            throw new CommandExecutionError('semanticscholar recommendations returned an unexpected payload shape');\n        }\n        if (!recommended.length) {\n            throw new EmptyResultError('semanticscholar recommendations', `No Semantic Scholar recommendations for \"${args.id}\".`);\n        }\n\n        return recommended.slice(0, limit).map((p, i) => normalizePaperRow(p, 'recommendations', { rank: i + 1 }));\n    },\n});\n","sourceCodeStart":24,"sourceCodeEnd":48,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/semanticscholar/recommendations.js#L24-L48","documentation":"This EmptyResultError (clis/semanticscholar/recommendations.js:42) is thrown when the recommendations endpoint succeeded but recommendedPapers was an empty array — the service simply has no recommendations for the given paper. It is an expected, benign outcome, not a request failure.","triggerScenarios":"Calling `semanticscholar recommendations <id>` for a paper too new, too obscure, or of a type the recommender does not cover; very recent papers with no embedding/citation graph yet; non-English or niche venues with sparse graph data.","commonSituations":"Querying brand-new preprints days after publication; papers with minimal metadata in the S2 corpus; expecting recommendations for dataset/withdrawn papers; users confusing zero recommendations with an API failure.","solutions":["Confirm the paper exists and has citations via `semanticscholar paper <id>` — well-cited papers usually get recommendations.","Try a related, better-established paper as the recommendation seed.","Treat this error as 'no data' in scripts rather than retrying — retrying will not change the outcome.","Wait and retry only if the paper was published very recently; the recommender indexes with a delay."],"exampleFix":"// before\nconst recs = await recommendations(id); // throws on empty\n// after\nlet recs;\ntry {\n  recs = await recommendations(id);\n} catch (err) {\n  if (isEmptyResult(err)) recs = []; // no recommendations yet\n  else throw err;\n}","handlingStrategy":"fallback","validationCode":"// Prefer seeds with citation graph presence:\nconst paper = await cli('semanticscholar paper', id, { json: true });\nif ((paper.citationCount ?? 0) === 0) return []; // recommendations will be empty; skip the call","typeGuard":"function isEmptyResultError(err) {\n  return err instanceof Error && err.name === 'EmptyResultError';\n}","tryCatchPattern":"try {\n  recs = await recommendations(id);\n} catch (err) {\n  if (isEmptyResultError(err)) {\n    return { recommendations: [], reason: 'no S2 recommendations for this paper' };\n  }\n  throw err;\n}","preventionTips":["Treat empty recommendations as data, not failure — do not retry blindly.","Seed from established, well-cited papers for better hit rates.","For very new papers, delay recommendation queries until the recommender indexes them.","Distinguish EmptyResultError from other errors in catch blocks so scripts degrade gracefully."],"tags":["empty-result","semanticscholar","expected-condition","recommendations"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}