{"record":{"id":"df7a26ffb8673d9d","repo":"jackwener/OpenCLI","slug":"oeis-search","errorCode":"oeis search","errorMessage":"No OEIS sequences matched \"${query}\".","messagePattern":"No OEIS sequences matched \"(.+?)\"\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/oeis/search.js","lineNumber":47,"sourceCode":"        const collected = [];\n        let start = 0;\n        const pageSize = 10;\n        // Cap iterations defensively at limit/pageSize + 1 so we never spin forever.\n        const maxPages = Math.ceil(limit / pageSize) + 1;\n        for (let page = 0; page < maxPages && collected.length < limit; page++) {\n            const url = `${OEIS_BASE}/search?q=${encodeURIComponent(query)}&fmt=json&start=${start}`;\n            const body = await oeisFetch(url, 'oeis search');\n            const list = Array.isArray(body) ? body : [];\n            if (!list.length) break;\n            for (const r of list) {\n                if (collected.length >= limit) break;\n                collected.push(r);\n            }\n            if (list.length < pageSize) break;\n            start += pageSize;\n        }\n        if (!collected.length) {\n            throw new EmptyResultError('oeis search', `No OEIS sequences matched \"${query}\".`);\n        }\n        return collected.map((r, i) => {\n            const id = formatId(r?.number);\n            return {\n                rank: i + 1,\n                id,\n                name: typeof r?.name === 'string' ? r.name : null,\n                keywords: typeof r?.keyword === 'string' ? r.keyword : null,\n                preview: previewTerms(r?.data),\n                author: typeof r?.author === 'string' ? r.author : null,\n                created: typeof r?.created === 'string' ? r.created : null,\n                url: id ? `${OEIS_BASE}/${id}` : '',\n            };\n        });\n    },\n});\n","sourceCodeStart":29,"sourceCodeEnd":64,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/oeis/search.js#L29-L64","documentation":"An EmptyResultError with code \"oeis search\" thrown when a paginated OEIS search collected zero results for the query. The OEIS API answered successfully but no sequences matched the search terms. The library raises this instead of returning an empty array so callers get an explicit signal.","triggerScenarios":"Calling the oeis search command with a query string that matches nothing: misspelled sequence terms, overly restrictive/long queries, or a query mixing too many numbers that no single sequence contains.","commonSituations":"Searching natural-language descriptions OEIS doesn't index, entering terms in the wrong order, searching for a typo'd number sequence, or querying keywords too specific (author names, dates).","solutions":["Simplify the query to just the numeric terms, e.g. \"1,2,4,8,16\".","Check spelling/typos in number sequences and keywords.","Try fewer terms — dropping the least important term widens the match.","Use OEIS's own web search to confirm results exist before scripting."],"exampleFix":"// before\noeis search \"primes ending in 7 discovered by Gauss\"\n// after\noeis search \"7,37,67,97\"","handlingStrategy":"try-catch","validationCode":"// require a non-empty query with at least one term\nconst q = String(raw ?? '').trim();\nif (!q) throw new Error('query required');","typeGuard":"const hasQuery = (v) => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":"try { return await oeisSearch(q); } catch (e) { if (e.code === 'oeis search') return suggestQueryBroadening(q); throw e; }","preventionTips":["Search plain comma-separated number terms, not prose.","Validate queries non-empty before invoking.","Test the query on oeis.org interactively first.","Programmatically relax the query (drop terms) and retry once on empty results."],"tags":["empty-result","not-found","oeis","search"],"backgroundTag":"search-no-results","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}