jackwener/OpenCLI · warning · EmptyResultError

Paper ${args.id} was not found. Check the arXiv ID format, e

Error message

Paper ${args.id} was not found. Check the arXiv ID format, e.g. 1706.03762

What it means

An EmptyResultError thrown when fetching a paper by arXiv ID returns no entries. The command queries arXiv's id_list endpoint and, if the response parses to zero entries, concludes the ID does not correspond to any paper. Commonly caused by a malformed or nonexistent ID, since arXiv silently returns an empty feed for unknown id_list values rather than an HTTP error.

Source

Thrown at clis/arxiv/paper.js:19

import { cli, Strategy } from '@jackwener/opencli/registry';
import { EmptyResultError } from '@jackwener/opencli/errors';
import { arxivFetch, parseEntries } from './utils.js';
cli({
    site: 'arxiv',
    name: 'paper',
    access: 'read',
    description: 'Get arXiv paper details by ID',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'id', positional: true, required: true, help: 'arXiv paper ID (e.g. 1706.03762)' },
    ],
    columns: ['id', 'title', 'authors', 'published', 'updated', 'primary_category', 'categories', 'abstract', 'comment', 'pdf', 'url'],
    func: async (args) => {
        const xml = await arxivFetch(`id_list=${encodeURIComponent(args.id)}`);
        const entries = parseEntries(xml);
        if (!entries.length)
            throw new EmptyResultError('arxiv paper', `Paper ${args.id} was not found. Check the arXiv ID format, e.g. 1706.03762`);
        return entries;
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the ID format: modern IDs look like 1706.03762 (optionally v2), old ones like cond-mat/0703470
  2. Check the paper exists at https://arxiv.org/abs/<id> in a browser
  3. Strip any URL prefix — pass only the bare ID, not the full arxiv.org/abs/ URL
  4. Use `opencli arxiv search <title keywords>` to find the correct ID

Example fix

// before
await exec('opencli arxiv paper ' + userInput); // may be a URL or DOI
// after
const m = String(userInput).match(/(\d{4}\.\d{4,5})(v\d+)?$/);
if (!m) throw new Error('not an arXiv ID: ' + userInput);
await exec('opencli arxiv paper ' + m[1]);
Defensive patterns

Strategy: validation

Validate before calling

const id = String(paperId || '').trim().replace(/^https?:\/\/arxiv\.org\/(abs|pdf)\//, '');
if (!/^(\d{4}\.\d{4,5}|[a-z-]+\/\d{7})(v\d+)?$/i.test(id)) {
  throw new Error(`not a valid arXiv ID: ${paperId}`);
}

Type guard

function isArxivId(s) { return typeof s === 'string' && /^(\d{4}\.\d{4,5}|[a-z-]+\/\d{7})(v\d+)?$/i.test(s.trim()); }

Try / catch

try {
  return await exec('opencli arxiv paper ' + id);
} catch (e) {
  if (e.name === 'EmptyResultError') {
    console.error('ID not found; verify at https://arxiv.org/abs/' + id);
    return null;
  }
  throw e;
}

Prevention

When it happens

Trigger: `opencli arxiv paper <id>` where the id_list query yields no entries: wrong ID digits, missing version handling, old-style IDs with wrong prefix (math/9901001v1), or IDs containing characters that break the query.

Common situations: Typo'd IDs from citations or notes; passing a DOI or URL instead of an arXiv ID; papers withdrawn/removed from arXiv; confusion between the arXiv ID and the published journal ID.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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