{"record":{"id":"aa421e3505bd19c7","repo":"jackwener/OpenCLI","slug":"bbc-topic-args-topic-is-not-supported","errorCode":null,"errorMessage":"bbc topic \"${args.topic}\" is not supported","messagePattern":"bbc topic \"(.+?)\" is not supported","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"warning","filePath":"clis/bbc/topic.js","lineNumber":38,"sourceCode":"];\n\ncli({\n    site: 'bbc',\n    name: 'topic',\n    access: 'read',\n    description: 'BBC News headlines for a specific section (RSS feed)',\n    domain: 'www.bbc.com',\n    strategy: Strategy.PUBLIC,\n    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    },","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/bbc/topic.js#L20-L56","documentation":"ArgumentError from `bbc topic` when the requested topic, after normalization (trim, lowercase, spaces/hyphens to underscores), is not in the TOPICS allowlist. The library validates the topic before fetching the RSS feed, listing all supported topics in the suggestion.","triggerScenarios":"`bbc topic <name>` with a misspelled topic, an unsupported category (BBC has no feed for it), or free-form text with spaces/hyphens that normalizes to an unknown key.","commonSituations":"Users guessing topic names ('tech news' vs 'technology'), topics removed/renamed by BBC, capitalization or pluralization mistakes ('Businesses' vs 'business').","solutions":["Use the suggestion text listing supported topics and pick an exact one.","Normalize your input: lowercase, single words matching TOPICS entries.","Check the CLI help (`bbc topic --help`) for the current topic list.","Request the topic be added if BBC actually publishes that feed."],"exampleFix":"// before\nawait cli.run(['bbc','topic','Tech News']);\n// after\nawait cli.run(['bbc','topic','technology']);","handlingStrategy":"validation","validationCode":"const TOPICS = ['news','world','uk','business','politics','health','education','science','technology','entertainment','stories'];\nfunction assertTopic(t){ const n = String(t??'').trim().toLowerCase().replace(/[\\s-]+/g,'_'); if(!TOPICS.includes(n)) throw new Error(`unsupported topic: ${t}`); }","typeGuard":"const isSupportedTopic = (t, topics) => topics.includes(String(t??'').trim().toLowerCase().replace(/[\\s-]+/g,'_'));","tryCatchPattern":"try {\n  const items = await cli.run(['bbc','topic', topic]);\n} catch (e) {\n  if (e.name === 'ArgumentError' && /not supported/.test(e.message)) {\n    console.error(e.message, e.suggestion || '');\n  }\n}","preventionTips":["Pick topics from the CLI --help list exactly","Lowercase and underscore-normalize topic input","Cache the supported TOPICS list and validate UI dropdowns against it","Treat ArgumentError suggestions as authoritative"],"tags":["bbc","argument","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}