{"record":{"id":"c409cc90ec672afd","repo":"DIYgod/RSSHub","slug":"bad-category-see-a-href-https-docs-rsshub-app-c409cc","errorCode":null,"errorMessage":"Bad category. See <a href=\"https://docs.rsshub.app/routes/government#hu-bei-ruan-jian-hang-ye-xie-hui\">docs</a>","messagePattern":"Bad category\\. See <a href=\"https://docs\\.rsshub\\.app/routes/government#hu-bei-ruan-jian-hang-ye-xie-hui\">docs</a>","errorType":"exception","errorClass":null,"httpStatus":503,"severity":"warning","filePath":"lib/routes-deprecated/gov/hubei/hbsia.js","lineNumber":61,"sourceCode":"    yyal: { title: '应用案例' },\n    xgxzi: { title: 'ITSS相关下载' },\n\n    xydjpj: { title: '信用等级评价' },\n    kjcgpj: { title: '科技成果评价' },\n    dbpc: { title: '等保评测' },\n    rjzj: { title: '软件造价' },\n    txrz: { title: '体系认证' },\n    zxjsfw: { title: '专项技术服务' },\n\n    shzzdj: { title: '社会组织党建' },\n    xyzl: { title: '行业自律' },\n    xhkw: { title: '协会刊物' },\n};\n\nmodule.exports = async (ctx) => {\n    const cfg = config[ctx.params.caty];\n    if (!cfg) {\n        throw new Error('Bad category. See <a href=\"https://docs.rsshub.app/routes/government#hu-bei-ruan-jian-hang-ye-xie-hui\">docs</a>');\n    }\n\n    const current_url = url.resolve(root_url, `/${ctx.params.caty}/index.jhtml`);\n    const response = await got({\n        method: 'get',\n        url: current_url,\n    });\n    const $ = cheerio.load(response.data);\n    const list = $('div.i_content li')\n        .slice(0, 20)\n        .map((_, item) => {\n            item = $(item);\n            const a = item.find('a[href]');\n            const span = item.find('span');\n            return {\n                title: a.text(),\n                link: url.resolve(current_url, a.attr('href')),\n                pubDate: parseDate(span.text(), 'YYYY-MM-DD'),","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes-deprecated/gov/hubei/hbsia.js#L43-L79","documentation":"Thrown by the Hubei Software Industry Association route (deprecated) when :caty is not a config key. The config holds only titles (e.g. rjzj, txrz, zxjsfw, shzzdj, xyzl, xhkw) and the URL is built as /<caty>/index.jhtml, so a miss throws before the request.","triggerScenarios":"Request with a category slug not in the config map; the throw fires at config[ctx.params.caty].","commonSituations":"Slug typo, or the association site dropping a section so its slug was removed from config. Because the slug is also interpolated into the URL, even a near-miss would 404 downstream if the guard were absent.","solutions":["Use a documented slug such as rjzj, txrz, zxjsfw, shzzdj, xyzl, or xhkw.","Check the config map at the top of lib/routes-deprecated/gov/hubei/hbsia.js.","If the section 404s on the source site, report it rather than substituting a slug."],"exampleFix":"// before\nGET /gov/hubei/hbsia/ruanjian   // not a key\n// after\nGET /gov/hubei/hbsia/rjzj         // 软件造价","handlingStrategy":"validation","validationCode":"const VALID = ['rjzj', 'txrz', 'zxjsfw', 'shzzdj', 'xyzl', 'xhkw'];\nif (!VALID.includes(ctx.params.caty)) throw new Error(`Invalid caty. Valid: ${VALID.join(', ')}`);","typeGuard":"const isCaty = (v: string): v is 'rjzj' | 'txrz' | 'zxjsfw' | 'shzzdj' | 'xyzl' | 'xhkw' =>\n  ['rjzj','txrz','zxjsfw','shzzdj','xyzl','xhkw'].includes(v);","tryCatchPattern":"try { await fetch(route); }\ncatch (e) { if (/Bad category/.test(e.message)) promptSlug(); else throw e; }","preventionTips":["Slug is also part of the URL — typos would 404 even without the guard.","Verify the section still exists on the association site."],"tags":["rsshub","parameter-validation","deprecated-route","government"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}