jackwener/OpenCLI · warning · EmptyResultError

oeis sequence

oeis sequence

Error message

OEIS sequence "${id}" not found.

What it means

An EmptyResultError with code "oeis sequence" thrown when the id-based OEIS lookup (search?q=id:A<n>&fmt=json) returns an empty array, meaning OEIS has no sequence with that A-number. The id passed requireSequenceId validation, so it is well-formed but unknown.

Source

Thrown at clis/oeis/sequence.js:48

        'termCount',
        'offset',
        'author',
        'created',
        'revision',
        'commentCount',
        'formulaCount',
        'referenceCount',
        'xrefCount',
        'linkCount',
        'url',
    ],
    func: async (args) => {
        const id = requireSequenceId(args.id);
        const url = `${OEIS_BASE}/search?q=id:${encodeURIComponent(id)}&fmt=json`;
        const body = await oeisFetch(url, 'oeis sequence');
        const list = Array.isArray(body) ? body : [];
        if (!list.length) {
            throw new EmptyResultError('oeis sequence', `OEIS sequence "${id}" not found.`);
        }
        const r = list[0];
        const data = typeof r?.data === 'string' ? r.data : '';
        const termCount = data ? data.split(',').filter(Boolean).length : 0;
        return [{
            id: formatId(r?.number) ?? id,
            name: typeof r?.name === 'string' ? r.name : null,
            keywords: typeof r?.keyword === 'string' ? r.keyword : null,
            preview: previewTerms(data),
            termCount,
            offset: typeof r?.offset === 'string' ? r.offset : null,
            author: typeof r?.author === 'string' ? r.author : null,
            created: typeof r?.created === 'string' ? r.created : null,
            revision: typeof r?.revision === 'number' ? r.revision : null,
            commentCount: asArray(r?.comment).length,
            formulaCount: asArray(r?.formula).length,
            referenceCount: asArray(r?.reference).length,
            xrefCount: asArray(r?.xref).length,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the A-number on oeis.org directly (oeis.org/A000045).
  2. Use oeis search with the sequence terms instead of the id to recover the correct id.
  3. Check for digit transposition in the id you typed.
  4. Confirm the entry still exists — OEIS occasionally renumbers or merges sequences.

Example fix

// before
oeis sequence A0000046
// after (Fibonacci)
oeis sequence A000045
Defensive patterns

Strategy: fallback

Validate before calling

const SEQ_ID = /^A\d{1,7}$/;
if (!SEQ_ID.test(String(raw ?? '').trim())) throw new Error('bad A-number');

Type guard

const isSeqId = (v) => /^A\d{1,7}$/.test(String(v ?? '').trim());

Try / catch

try { return await oeisSequence(id); } catch (e) { if (e.code === 'oeis sequence') return null; throw e; }

Prevention

When it happens

Trigger: Requesting a well-formed but non-existent A-number (e.g. A9999999), a mistyped digit in a valid id, or referencing an id from a stale cache/link pointing at a renumbered/removed entry.

Common situations: Typos when transcribing A-numbers from papers or logs, assuming ids are contiguous, or using fabricated ids in generated test data.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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