jackwener/OpenCLI · warning · ArgumentError

bbc topic " " is not supported

Error message

bbc topic "${args.topic}" is not supported

What it means

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.

Solutions

  1. Use the suggestion text listing supported topics and pick an exact one.
  2. Normalize your input: lowercase, single words matching TOPICS entries.
  3. Check the CLI help (`bbc topic --help`) for the current topic list.
  4. Request the topic be added if BBC actually publishes that feed.

Example fix

// before
await cli.run(['bbc','topic','Tech News']);
// after
await cli.run(['bbc','topic','technology']);
Defensive patterns

Strategy: validation

Validate before calling

const TOPICS = ['news','world','uk','business','politics','health','education','science','technology','entertainment','stories'];
function assertTopic(t){ const n = String(t??'').trim().toLowerCase().replace(/[\s-]+/g,'_'); if(!TOPICS.includes(n)) throw new Error(`unsupported topic: ${t}`); }

Type guard

const isSupportedTopic = (t, topics) => topics.includes(String(t??'').trim().toLowerCase().replace(/[\s-]+/g,'_'));

Try / catch

try {
  const items = await cli.run(['bbc','topic', topic]);
} catch (e) {
  if (e.name === 'ArgumentError' && /not supported/.test(e.message)) {
    console.error(e.message, e.suggestion || '');
  }
}

Prevention

When it happens

Trigger: `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.

Common situations: Users guessing topic names ('tech news' vs 'technology'), topics removed/renamed by BBC, capitalization or pluralization mistakes ('Businesses' vs 'business').

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at clis/bbc/topic.js:38

];

cli({
    site: 'bbc',
    name: 'topic',
    access: 'read',
    description: 'BBC News headlines for a specific section (RSS feed)',
    domain: 'www.bbc.com',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'topic', positional: true, required: true, help: `Section name (${TOPICS.join(' / ')})` },
        { name: 'limit', type: 'int', default: 20, help: 'Max headlines (1-50)' },
    ],
    columns: ['rank', 'title', 'description', 'pubDate', 'url'],
    func: async (args) => {
        const raw = String(args.topic ?? '').trim().toLowerCase().replace(/[\s-]+/g, '_');
        if (!TOPICS.includes(raw)) {
            throw new ArgumentError(
                `bbc topic "${args.topic}" is not supported`,
                `Supported topics: ${TOPICS.join(', ')}`,
            );
        }
        const limit = requireBoundedInt(args.limit, 20, 50);
        const xml = await bbcFetchRss(`${raw}/rss.xml`, `bbc topic ${raw}`);
        const items = parseRssItems(xml);
        if (!items.length) {
            throw new EmptyResultError('bbc topic', `BBC ${raw} feed returned no items.`);
        }
        return items.slice(0, limit).map((it, i) => ({
            rank: i + 1,
            title: it.title,
            description: it.description,
            pubDate: pubDateToIso(it.pubDate),
            url: it.link,
        }));
    },

View on GitHub (pinned to 49907e53dc)