DIYgod/RSSHub · error · InvalidParameterError
Bad category. See <a href="https://docs.rsshub.app/routes/go
Error message
Bad category. See <a href="https://docs.rsshub.app/routes/government#guang-dong-sheng-ren-min-zheng-fu-guang-dong-sheng-shen-zhen-shi-ren-min-zheng-fu">docs</a>
What it means
Thrown as an InvalidParameterError by the Shenzhen government information disclosure route when the ':caty' path parameter is not a key in the config object. Four valid categories are defined: tzgg (通知公告), zfcg (政府采购), zjxx (资金信息), zdxm (重大项目). Each maps to a specific sub-path on www.sz.gov.cn.
Source
Thrown at lib/routes/gov/shenzhen/xxgk/zfxxgj.ts:55
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: '政府信息公开',
maintainers: ['laoxua'],
handler,
description: `| 通知公告 | 政府采购 | 资金信息 | 重大项目 |
| :------: | :------: | :------: | :------: |
| tzgg | zfcg | zjxx | zdxm |`,
};
async function handler(ctx) {
const cfg = config[ctx.req.param('caty')];
if (!cfg) {
throw new InvalidParameterError('Bad category. See <a href="https://docs.rsshub.app/routes/government#guang-dong-sheng-ren-min-zheng-fu-guang-dong-sheng-shen-zhen-shi-ren-min-zheng-fu">docs</a>');
}
const currentUrl = new URL(cfg.link, rootUrl).href;
const response = await got(currentUrl);
const $ = load(response.data);
const list = $('div.zx_ml_list ul li span.tit')
.toArray()
.map((item): DataItem => {
const $item = $(item).find('a');
return {
title: $item.text(),
link: $item.attr('href'),
};
});
const items = await Promise.all(
list.map((item) =>
cache.tryGet(item.link!, async () => {View on GitHub (pinned to bed535e087)
Solutions
- Use one of the four valid categories: tzgg, zfcg, zjxx, zdxm
- Refer to the route description table for the mapping
- Use the documented example: /gov/shenzhen/xxgk/zfxxgj/tzgg
Example fix
// No code fix needed — the error message links to docs. // Valid values: tzgg, zfcg, zjxx, zdxm // Example: /gov/shenzhen/xxgk/zfxxgj/tzgg
Defensive patterns
Strategy: validation
Validate before calling
const VALID_CATEGORIES = ['tzgg', 'zfcg', 'zjxx', 'zdxm'];
const caty = ctx.req.param('caty');
if (!VALID_CATEGORIES.includes(caty)) {
throw new InvalidParameterError(`Bad category '${caty}'. Valid: ${VALID_CATEGORIES.join(', ')}`);
} Type guard
function isValidZfxxgjCategory(caty: string): caty is 'tzgg' | 'zfcg' | 'zjxx' | 'zdxm' {
return ['tzgg', 'zfcg', 'zjxx', 'zdxm'].includes(caty);
} Prevention
- Use pinyin codes, not Chinese characters
- Refer to the route description table for the four valid categories
- Use the documented example: /gov/shenzhen/xxgk/zfxxgj/tzgg
When it happens
Trigger: A request to /gov/shenzhen/xxgk/zfxxgj/:caty where caty is not 'tzgg', 'zfcg', 'zjxx', or 'zdxm'. The check is 'if (!cfg)' where cfg = config[ctx.req.param('caty')].
Common situations: Typo in the category code; using a category code from a different Shenzhen route (e.g., 'bmxx' which belongs to the exam institute route); using Chinese characters instead of pinyin codes.
Related errors
- Invalid channel Id: ${id}
- Unknown category: ${ctx.req.param('category')}
- Bad category. See <a href="https://docs.rsshub.app/routes/go
- Invalid category
- At least one valid search parameter is required
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/5351341da69e4d5b.
Report an issue: GitHub.