{"record":{"id":"80d635e5b8baa68e","repo":"DIYgod/RSSHub","slug":"bad-category-see-a-href-https-docs-rsshub-app-80d635","errorCode":null,"errorMessage":"Bad category. See <a href=\"https://docs.rsshub.app/routes/new-media#it-zhi-jia\">https://docs.rsshub.app/routes/new-media#it-zhi-jia</a>","messagePattern":"Bad category\\. See <a href=\"https://docs\\.rsshub\\.app/routes/new-media#it-zhi-jia\">https://docs\\.rsshub\\.app/routes/new-media#it-zhi-jia</a>","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"error","filePath":"lib/routes/ithome/index.ts","lineNumber":64,"sourceCode":"        requireConfig: false,\n        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: '分类资讯',\n    maintainers: ['luyuhuang'],\n    handler,\n    description: `| it      | soft     | win10      | win11      | iphone      | ipad      | android      | digi     | next     |\n| ------- | -------- | ---------- | ---------- | ----------- | --------- | ------------ | -------- | -------- |\n| IT 资讯 | 软件之家 | win10 之家 | win11 之家 | iphone 之家 | ipad 之家 | android 之家 | 数码之家 | 智能时代 |`,\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/new-media#it-zhi-jia\">https://docs.rsshub.app/routes/new-media#it-zhi-jia</a>');\n    }\n\n    const current_url = get_url(ctx.req.param('caty'));\n    const response = await got({\n        method: 'get',\n        url: current_url,\n    });\n\n    const $ = load(response.data);\n    const list = $('#list > div.fl > ul > li > div > h2 > a')\n        .slice(0, 10)\n        .toArray()\n        .map((item): DataItem => {\n            const $item = $(item);\n            return {\n                title: $item.text(),\n                link: $item.attr('href'),\n            };","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/ithome/index.ts#L46-L82","documentation":"Thrown by the IT之家 (ithome) category-news route as `InvalidParameterError` when `ctx.req.param('caty')` is not a key in the route's `config` map. Valid categories are `it`, `soft`, `win10`, `win11`, `iphone`, `ipad`, `android`, `digi`, `next`.","triggerScenarios":"Request to `/ithome/:caty` with a category not in the config map — e.g. `/ithome/news`, `/ithome/hardware`, a typo, or a Chinese display name instead of the English key.","commonSituations":"User passes the Chinese display name instead of the English key; outdated docs referencing a removed category; typo.","solutions":["Use one of the documented keys: `/ithome/it`, `/ithome/soft`, `/ithome/win10`, `/ithome/win11`, `/ithome/iphone`, `/ithome/ipad`, `/ithome/android`, `/ithome/digi`, `/ithome/next`.","If a new category is needed, add it to the `config` map in lib/routes/ithome/index.ts with its URL builder."],"exampleFix":"// before: /ithome/news\n// after:  /ithome/it","handlingStrategy":"validation","validationCode":"const cfg = config[ctx.req.param('caty')];\nif (!cfg) throw new InvalidParameterError(`Bad category. Valid: ${Object.keys(config).join(', ')}`);","typeGuard":"const isKnownCategory = (c: string): c is keyof typeof config => c in config;","tryCatchPattern":null,"preventionTips":["Use the English key, not the Chinese display name.","List valid keys in the error message for fast diagnosis.","Keep the config map as the single source of truth."],"tags":["ithome","invalid-parameter","category"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}