{"record":{"id":"6efd62636822d9b0","repo":"jackwener/OpenCLI","slug":"pubmed-author","errorCode":null,"errorMessage":"pubmed author","messagePattern":"pubmed author","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"info","filePath":"clis/pubmed/author.js","lineNumber":60,"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 author' });\n        const pmids = esearch?.esearchresult?.idlist;\n        if (!Array.isArray(pmids)) {\n            throw new CommandExecutionError('pubmed author did not return an id list', 'PubMed ESearch response shape may have changed.');\n        }\n        if (pmids.length === 0) {\n            throw new EmptyResultError('pubmed author', `No articles found for author \"${name}\".`);\n        }\n        return fetchSummaryRows(pmids, 'pubmed author summary');\n    },\n});\n","sourceCodeStart":42,"sourceCodeEnd":65,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pubmed/author.js#L42-L65","documentation":"EmptyResultError('pubmed author') thrown at clis/pubmed/author.js:60 when ESearch succeeded and returned a valid idlist array, but the array is empty — i.e. no PubMed articles match the constructed author query (name[author-tag] plus optional affiliation and date-range terms). This is a legitimate 'no results' outcome, not an API failure.","triggerScenarios":"esearchresult.idlist exists but length === 0 because: (a) the author name is misspelled or uses an uncommon format ('Smith J' vs 'Smith, John'), (b) the affiliation [ad] term or year range is too restrictive, (c) sort pub_date combined with filters excludes all hits, (d) the author has no PubMed-indexed publications.","commonSituations":"Searching a nickname/maiden name; adding an affiliation string that doesn't match how it appears in PubMed's [ad] index; a narrow year window missing the author's active period; searching for a non-researcher or non-PubMed-indexed author.","solutions":["Simplify the query: search the surname plus initials only, without affiliation or year filters, and confirm hits exist","Try alternative name formats ('Smith JA', 'Smith, John A') — PubMed author indexing is format-sensitive","Widen the year range or drop the affiliation term, then re-narrow gradually","Use PubMed's advanced search in a browser to verify the author has indexed publications","Check the authorTag used in the term construction matches PubMed's field tags (e.g. [Author] vs [1au])"],"exampleFix":"// before\nawait runCli('pubmed author \"Jane Q Doe\"', { affiliation: 'Acme Genomics Lab', 'year-from': 2024, 'year-to': 2024 });\n// after\nawait runCli('pubmed author \"Doe J\"', {}); // start broad, then narrow with affiliation/year filters","handlingStrategy":"try-catch","validationCode":"// sanity-check the author string format before searching\nconst normalized = name.trim();\nif (!/^[\\p{L}'\\-., ]+$/u.test(normalized) || normalized.length < 2) {\n  throw new Error(`\"${name}\" does not look like an author name`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const rows = await runCli('pubmed author', { name });\n} catch (e) {\n  if (e instanceof EmptyResultError || /No articles found for author/.test(e.message)) {\n    console.warn(`No PubMed hits for \"${name}\" — try surname + initials format.`);\n    return [];\n  }\n  throw e;\n}","preventionTips":["Start with broad queries (surname + initials) and add affiliation/year filters only after confirming hits","Handle multiple name formats: 'Smith J', 'Smith, John A', full name","Verify the author exists via PubMed's web advanced search before automating","Treat empty results as data, not errors, in batch pipelines"],"tags":["api","pubmed","empty-result","search"],"backgroundTag":"empty-result","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}