{"record":{"id":"1ede36d92041046e","repo":"jackwener/OpenCLI","slug":"pubmed-journal","errorCode":null,"errorMessage":"pubmed journal","messagePattern":"pubmed journal","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"info","filePath":"clis/pubmed/journal.js","lineNumber":55,"sourceCode":"            const from = yearFrom || 1800;\n            const to = yearTo || new Date().getFullYear();\n            if (from > to) {\n                throw new ArgumentError('pubmed year-from must be <= year-to');\n            }\n            terms.push(`${from}:${to}[PDAT]`);\n        }\n        const esearch = await eutilsFetch('esearch', {\n            term: terms.join(' AND '),\n            retmax: limit,\n            usehistory: 'y',\n            sort: sort === 'date' ? 'pub_date' : '',\n        }, { label: 'pubmed journal' });\n        const pmids = esearch?.esearchresult?.idlist;\n        if (!Array.isArray(pmids)) {\n            throw new CommandExecutionError('pubmed journal did not return an id list', 'PubMed ESearch response shape may have changed.');\n        }\n        if (pmids.length === 0) {\n            throw new EmptyResultError('pubmed journal', `No articles found for journal \"${journal}\".`);\n        }\n        return fetchSummaryRows(pmids, 'pubmed journal summary');\n    },\n});\n","sourceCodeStart":37,"sourceCodeEnd":60,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pubmed/journal.js#L37-L60","documentation":"This EmptyResultError is thrown when the PubMed ESearch for the given journal succeeded but returned zero PMIDs, i.e. no articles matched the journal (and optional year range) query. The first argument is the command name 'pubmed journal'; the message includes the journal name. It signals a valid-but-empty search, not a failure.","triggerScenarios":"Calling the journal command with a misspelled or non-existent journal abbreviation (e.g. 'Nature Genetix'); a year range where the journal had no articles; using the full journal name where PubMed expects the MEDLINE abbreviation, so `journal[X]` matches nothing.","commonSituations":"Typo in journal name; using 'The Lancet' instead of 'Lancet'; overly narrow year-from/year-to window; querying a very new or discontinued journal with no indexed matches.","solutions":["Check the journal name/abbreviation against the NCBI Journal List (use the MEDLINE abbreviation, e.g. 'N Engl J Med')","Widen or remove the year-from/year-to range","Reduce other query constraints (sort/limit do not affect matching, but review any extra terms)","Verify with a plain pubmed search that the journal string matches anything"],"exampleFix":"// before\nclis.pubmedJournal({ journal: 'The New England Journal of Medicine', yearFrom: 2024, yearTo: 2024 });\n// after\nclis.pubmedJournal({ journal: 'N Engl J Med' });","handlingStrategy":"fallback","validationCode":"// Pre-flight: check the journal abbreviation resolves via a cheap ESearch count\nconst probe = await eutilsFetch('esearch', { term: `${journal}[Journal]`, retmax: 0 }, { label: 'probe' });\nconst count = Number(probe?.esearchresult?.count ?? 0);\nif (count === 0) console.warn(`No PubMed articles for journal \"${journal}\"`);","typeGuard":null,"tryCatchPattern":"try {\n  return await clis.pubmedJournal({ journal, yearFrom, yearTo });\n} catch (e) {\n  if (e.name === 'EmptyResultError' && e.scope === 'pubmed journal') {\n    return []; // or suggest corrected journal spellings\n  }\n  throw e;\n}","preventionTips":["Use MEDLINE journal abbreviations from the NCBI Catalog, not full display names","Avoid ultra-narrow year windows unless you know coverage exists","Offer fuzzy-match suggestions (e.g. via NCBI journal search) in your UI","Treat EmptyResultError as a normal outcome and handle it separately from transport errors"],"tags":["empty-result","search","pubmed","query"],"backgroundTag":"empty-search-result","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}