{"record":{"id":"5351341da69e4d5b","repo":"DIYgod/RSSHub","slug":"bad-category-see-a-href-https-docs-rsshub-app-535134","errorCode":null,"errorMessage":"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>","messagePattern":"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>","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"error","filePath":"lib/routes/gov/shenzhen/xxgk/zfxxgj.ts","lineNumber":55,"sourceCode":"        requireConfig: false,\n        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: '政府信息公开',\n    maintainers: ['laoxua'],\n    handler,\n    description: `| 通知公告 | 政府采购 | 资金信息 | 重大项目 |\n| :------: | :------: | :------: | :------: |\n|   tzgg   |   zfcg   |   zjxx   |   zdxm   |`,\n};\n\nasync function handler(ctx) {\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#guang-dong-sheng-ren-min-zheng-fu-guang-dong-sheng-shen-zhen-shi-ren-min-zheng-fu\">docs</a>');\n    }\n\n    const currentUrl = new URL(cfg.link, rootUrl).href;\n    const response = await got(currentUrl);\n    const $ = load(response.data);\n    const list = $('div.zx_ml_list ul li span.tit')\n        .toArray()\n        .map((item): DataItem => {\n            const $item = $(item).find('a');\n            return {\n                title: $item.text(),\n                link: $item.attr('href'),\n            };\n        });\n\n    const items = await Promise.all(\n        list.map((item) =>\n            cache.tryGet(item.link!, async () => {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/gov/shenzhen/xxgk/zfxxgj.ts#L37-L73","documentation":"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.","triggerScenarios":"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')].","commonSituations":"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.","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"],"exampleFix":"// No code fix needed — the error message links to docs.\n// Valid values: tzgg, zfcg, zjxx, zdxm\n// Example: /gov/shenzhen/xxgk/zfxxgj/tzgg","handlingStrategy":"validation","validationCode":"const VALID_CATEGORIES = ['tzgg', 'zfcg', 'zjxx', 'zdxm'];\nconst caty = ctx.req.param('caty');\nif (!VALID_CATEGORIES.includes(caty)) {\n    throw new InvalidParameterError(`Bad category '${caty}'. Valid: ${VALID_CATEGORIES.join(', ')}`);\n}","typeGuard":"function isValidZfxxgjCategory(caty: string): caty is 'tzgg' | 'zfcg' | 'zjxx' | 'zdxm' {\n    return ['tzgg', 'zfcg', 'zjxx', 'zdxm'].includes(caty);\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["validation","invalid-parameter","government"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}