DIYgod/RSSHub · warning
Bad category. See <a href="https://docs.rsshub.app/routes/go
Error message
Bad category. See <a href="https://docs.rsshub.app/routes/government#zhong-guo-zheng-fu-tu-jie">docs</a>
What it means
Thrown by the China.gov 图解 (illustrated policy) route (deprecated) when :caty is not a config key (documented: zhengce 图解政策, qttj 其他图解). The URL is built as rootUrl + cfg.link, so a miss throws first.
Source
Thrown at lib/routes-deprecated/gov/xinwen/tujie.js:30
},
qtmh: {
link: '/manhua/qita.htm',
title: '其他漫画',
},
zhengce: {
link: '/tujie/zhengce.htm',
title: '图解政策',
},
qttj: {
link: '/tujie/qita.htm',
title: '其他图解',
},
};
module.exports = async (ctx) => {
const cfg = config[ctx.params.caty];
if (!cfg) {
throw new Error('Bad category. See <a href="https://docs.rsshub.app/routes/government#zhong-guo-zheng-fu-tu-jie">docs</a>');
}
const rootUrl = 'http://www.gov.cn/xinwen';
const currentUrl = rootUrl + cfg.link;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('div.Video_pane div.tplgd')
.slice(0, 15)
.map((_, item) => {
item = $(item);
const a = item.find('a').eq(1);
return {
title: a.text(),
link: `http://www.gov.cn${a.attr('href')}`,View on GitHub (pinned to bed535e087)
Solutions
- Use zhengce (图解政策) or qttj (其他图解).
- Verify against the config map at the top of lib/routes-deprecated/gov/xinwen/tujie.js.
- If the underlying .htm page 404s, report the route.
Example fix
// before GET /gov/xinwen/tujie/zhengcee // typo // after GET /gov/xinwen/tujie/zhengce // 图解政策
Defensive patterns
Strategy: validation
Validate before calling
const VALID = ['zhengce', 'qttj' /* see config in lib/routes-deprecated/gov/xinwen/tujie.js */];
if (!VALID.includes(ctx.params.caty)) throw new Error('Invalid caty'); Type guard
const isCaty = (v: string): v is 'zhengce' | 'qttj' => ['zhengce', 'qttj'].includes(v);
Try / catch
try { await fetch(route); }
catch (e) { if (/Bad category/.test(e.message)) listSlugs(); else throw e; } Prevention
- Confirm the .htm endpoints on www.gov.cn still exist.
- Validate before constructing the gov.cn URL.
When it happens
Trigger: Request with a slug outside the config map, e.g. /gov/xinwen/tujie/<unknown>.
Common situations: Slug typo, or the source site (www.gov.cn/xinwen) reorganizing the tujie section so a slug was dropped.
Related errors
- Bad category. See <a href="https://docs.rsshub.app/routes/go
- Bad category. See <a href="https://docs.rsshub.app/routes/go
- Nanjing, Cannot find page
- Bad category. See <a href="https://docs.rsshub.app/routes/go
- Bad category. See <a href="https://docs.rsshub.app/routes/go
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/dc5a051c64a687d5.
Report an issue: GitHub.