{"record":{"id":"a22b68cfafb4e346","repo":"jackwener/OpenCLI","slug":"bbc-raw-feed-returned-no-items","errorCode":null,"errorMessage":"BBC ${raw} feed returned no items.","messagePattern":"BBC (.+?) feed returned no items\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/bbc/topic.js","lineNumber":47,"sourceCode":"    browser: false,\n    args: [\n        { name: 'topic', positional: true, required: true, help: `Section name (${TOPICS.join(' / ')})` },\n        { name: 'limit', type: 'int', default: 20, help: 'Max headlines (1-50)' },\n    ],\n    columns: ['rank', 'title', 'description', 'pubDate', 'url'],\n    func: async (args) => {\n        const raw = String(args.topic ?? '').trim().toLowerCase().replace(/[\\s-]+/g, '_');\n        if (!TOPICS.includes(raw)) {\n            throw new ArgumentError(\n                `bbc topic \"${args.topic}\" is not supported`,\n                `Supported topics: ${TOPICS.join(', ')}`,\n            );\n        }\n        const limit = requireBoundedInt(args.limit, 20, 50);\n        const xml = await bbcFetchRss(`${raw}/rss.xml`, `bbc topic ${raw}`);\n        const items = parseRssItems(xml);\n        if (!items.length) {\n            throw new EmptyResultError('bbc topic', `BBC ${raw} feed returned no items.`);\n        }\n        return items.slice(0, limit).map((it, i) => ({\n            rank: i + 1,\n            title: it.title,\n            description: it.description,\n            pubDate: pubDateToIso(it.pubDate),\n            url: it.link,\n        }));\n    },\n});\n","sourceCodeStart":29,"sourceCodeEnd":58,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/bbc/topic.js#L29-L58","documentation":"EmptyResultError from `bbc topic` when the RSS feed was fetched successfully but `parseRssItems(xml)` produced zero items. The library treats a parsed-but-empty feed as a result-level failure so users know the topic is valid yet returned no headlines.","triggerScenarios":"`bbc topic <valid-topic>` where BBC's feed returns valid XML with no <item> elements — new/low-traffic topics, feed temporarily cleared, or XML whose structure the parser doesn't recognize.","commonSituations":"BBC deploys a feed with only <entry> (Atom) elements instead of <item>, brand-new topic feeds with no published stories yet, transient BBC publishing glitches, parser not handling namespaces (e.g. media:rss extensions breaking item extraction).","solutions":["Retry later — the feed may be temporarily empty or mid-publish.","Check the raw XML at https://feeds.bbci.co.uk/<topic>/rss.xml to confirm items exist.","If the feed uses Atom <entry> tags, update/fix the RSS parser to handle that format.","Try a different topic to confirm the parser works generally."],"exampleFix":"// before\nconst items = parseRssItems(xml);\n// after\nlet items = parseRssItems(xml);\nif (!items.length) items = parseAtomEntries(xml); // fallback for Atom feeds\nif (!items.length) throw new EmptyResultError('bbc topic', `BBC ${raw} feed returned no items.`);","handlingStrategy":"fallback","validationCode":"// after fetch: sanity-check the XML has items before full parse\nif (!/<item[\\s>]/.test(xml) && !/<entry[\\s>]/.test(xml)) throw new Error('feed contains no items');","typeGuard":"const xmlHasItems = (xml) => typeof xml === 'string' && /<(item|entry)[\\s>]/.test(xml);","tryCatchPattern":"try {\n  const items = await cli.run(['bbc','topic', topic]);\n} catch (e) {\n  if (e.name === 'EmptyResultError') {\n    // fall back to another topic or cached headlines\n  }\n}","preventionTips":["Retry transient empty feeds after a short delay","Support both RSS <item> and Atom <entry> parsing","Keep a cached copy of recent headlines as fallback","Verify feed XML directly at feeds.bbci.co.uk when debugging"],"tags":["bbc","rss","empty-result","parsing"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}