DIYgod/RSSHub · warning

Bad category. See <a href="https://docs.rsshub.app/routes/bb

Error message

Bad category. See <a href="https://docs.rsshub.app/routes/bbs#guang-gu-she-qu-zi-lun-tan">docs</a>

What it means

Thrown by the Guanggoo community forum route (deprecated) when the category (defaulting to 'index') is not a key of config (which includes index and city 城市建设 among others). config[category] undefined → throw before fetch.

Source

Thrown at lib/routes-deprecated/guanggoo/index.js:43

        link: '/node/finance',
        title: '金融财经',
    },
    startup: {
        link: '/node/startup',
        title: '创业创客',
    },
    city: {
        link: '/node/city',
        title: '城市建设',
    },
};

module.exports = async (ctx) => {
    const category = ctx.params.category || 'index';

    const cfg = config[category];
    if (!cfg) {
        throw new Error('Bad category. See <a href="https://docs.rsshub.app/routes/bbs#guang-gu-she-qu-zi-lun-tan">docs</a>');
    }

    const currentUrl = url.resolve(rootUrl, cfg.link);
    const response = await got({
        method: 'get',
        url: currentUrl,
    });

    const $ = cheerio.load(response.data);
    const list = $('div.topic-item h3 a')
        .slice(0, 10)
        .map((_, item) => {
            item = $(item);
            return {
                title: item.text(),
                link: url.resolve(rootUrl, item.attr('href').split('#')[0]),
            };
        })

View on GitHub (pinned to bed535e087)

Solutions

  1. Use a documented node slug (e.g. index, city).
  2. Check the config map at the top of lib/routes-deprecated/guanggoo/index.js for the full key list.
  3. Browse the live forum to find current node paths if config looks stale.

Example fix

// before
GET /guanggoo/citiy   // typo
// after
GET /guanggoo/city     // 城市建设
Defensive patterns

Strategy: validation

Validate before calling

const VALID = ['index', 'city' /* + see config in lib/routes-deprecated/guanggoo/index.js */];
const category = ctx.params.category || 'index';
if (!VALID.includes(category)) throw new Error(`Invalid category. Valid: ${VALID.join(', ')}`);

Type guard

const isCategory = (v: string): v is 'index' | 'city' => ['index', 'city'].includes(v);

Try / catch

try { await fetch(route); }
catch (e) { if (/Bad category/.test(e.message)) listBoards(); else throw e; }

Prevention

When it happens

Trigger: Request like /guanggoo/<unknown> where the segment is not a config key. Note the param defaults to 'index' so omitting it is safe.

Common situations: Typo in the node slug, or the forum renaming boards so old slugs were removed from config.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/00c9cd26301d1707. Report an issue: GitHub.