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#深圳市罗湖区人民政府">docs</a>
What it means
Thrown as an InvalidParameterError by the Shenzhen Luohu district government route when the ':caty' path parameter is not a key in the config object. Currently only one category is defined: 'tzgg' (通知公告 / Notice Announcements). The check is 'if (!cfg)' where cfg = config[ctx.req.param('caty')].
Source
Thrown at lib/routes/gov/shenzhen/szlh/index.ts:46
},
radar: [
{
source: ['szlh.gov.cn/zwfw/zffw/:caty'],
},
],
name: '罗湖区人民政府 政务服务',
maintainers: ['lonn'],
handler,
description: `| 通知公告 |
| :------: |
| tzgg |`,
};
async function handler(ctx) {
const baseUrl = 'http://www.szlh.gov.cn/zwfw/zffw/';
const cfg = config[ctx.req.param('caty')];
if (!cfg) {
throw new InvalidParameterError('Bad category. See <a href="https://docs.rsshub.app/routes/government#深圳市罗湖区人民政府">docs</a>');
}
const currentUrl = new URL(cfg.link, baseUrl).href;
const response = await ofetch(currentUrl);
const $ = load(response);
const items = $('div.lists ul li')
.toArray()
.map((item) => {
const $item = $(item);
const a = $item.find('a');
// Extract the date from <i>
const date = a.find('i').text();
// Remove <i> to get only the visible text
const textOnly = a.find('i').remove().end().text();View on GitHub (pinned to bed535e087)
Solutions
- Use the only valid category: /gov/shenzhen/szlh/zwfw/zffw/tzgg
- Check the route description table which shows only one option (tzgg)
- If you need other Luohu district categories, they may not be supported yet — consider contributing a new config entry
Example fix
// No code fix needed — the error message already links to docs. // The only valid value is 'tzgg'. Use: // /gov/shenzhen/szlh/zwfw/zffw/tzgg
Defensive patterns
Strategy: validation
Validate before calling
const VALID_CATEGORIES = ['tzgg']; // only one supported
const caty = ctx.req.param('caty');
if (!VALID_CATEGORIES.includes(caty)) {
throw new InvalidParameterError(`Bad category '${caty}'. Only 'tzgg' is supported.`);
} Type guard
function isValidSzlhCategory(caty: string): caty is 'tzgg' {
return caty === 'tzgg';
} Prevention
- This route only supports 'tzgg' — do not attempt other categories
- Check the route description table which shows a single option
- Other Shenzhen routes (zfxxgj) support more categories
When it happens
Trigger: A request to /gov/shenzhen/szlh/zwfw/zffw/:caty where caty is anything other than 'tzgg'. Since there is only one valid value, any other input — including common government category codes like 'zfcg' or 'zjxx' — will trigger this error.
Common situations: Assuming more categories exist than actually do (the route only supports tzgg); using category codes from other Shenzhen government routes that have more options; typo in 'tzgg'.
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/81455d5472491a22.
Report an issue: GitHub.