{"record":{"id":"81455d5472491a22","repo":"DIYgod/RSSHub","slug":"bad-category-see-a-href-https-docs-rsshub-app-81455d","errorCode":null,"errorMessage":"Bad category. See <a href=\"https://docs.rsshub.app/routes/government#深圳市罗湖区人民政府\">docs</a>","messagePattern":"Bad category\\. See <a href=\"https://docs\\.rsshub\\.app/routes/government#深圳市罗湖区人民政府\">docs</a>","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"error","filePath":"lib/routes/gov/shenzhen/szlh/index.ts","lineNumber":46,"sourceCode":"    },\n    radar: [\n        {\n            source: ['szlh.gov.cn/zwfw/zffw/:caty'],\n        },\n    ],\n    name: '罗湖区人民政府 政务服务',\n    maintainers: ['lonn'],\n    handler,\n    description: `| 通知公告 |\n| :------: |\n|   tzgg   |`,\n};\n\nasync function handler(ctx) {\n    const baseUrl = 'http://www.szlh.gov.cn/zwfw/zffw/';\n    const cfg = config[ctx.req.param('caty')];\n    if (!cfg) {\n        throw new InvalidParameterError('Bad category. See <a href=\"https://docs.rsshub.app/routes/government#深圳市罗湖区人民政府\">docs</a>');\n    }\n\n    const currentUrl = new URL(cfg.link, baseUrl).href;\n\n    const response = await ofetch(currentUrl);\n    const $ = load(response);\n\n    const items = $('div.lists ul li')\n        .toArray()\n        .map((item) => {\n            const $item = $(item);\n            const a = $item.find('a');\n\n            // Extract the date from <i>\n            const date = a.find('i').text();\n\n            // Remove <i> to get only the visible text\n            const textOnly = a.find('i').remove().end().text();","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/gov/shenzhen/szlh/index.ts#L28-L64","documentation":"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')].","triggerScenarios":"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.","commonSituations":"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'.","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"],"exampleFix":"// No code fix needed — the error message already links to docs.\n// The only valid value is 'tzgg'. Use:\n//   /gov/shenzhen/szlh/zwfw/zffw/tzgg","handlingStrategy":"validation","validationCode":"const VALID_CATEGORIES = ['tzgg']; // only one supported\nconst caty = ctx.req.param('caty');\nif (!VALID_CATEGORIES.includes(caty)) {\n    throw new InvalidParameterError(`Bad category '${caty}'. Only 'tzgg' is supported.`);\n}","typeGuard":"function isValidSzlhCategory(caty: string): caty is 'tzgg' {\n    return caty === 'tzgg';\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["validation","invalid-parameter","government","single-option"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}