{"record":{"id":"5a1a669205fb3b2c","repo":"DIYgod/RSSHub","slug":"bad-type-ctx-params-type-see-a-href-https","errorCode":null,"errorMessage":"Bad type: ${ctx.params.type}. See <a href=\"https://docs.rsshub.app/routes/game#beng-huai-3-you-xi-gong-gao\">docs</a>","messagePattern":"Bad type: (.+?)\\. See <a href=\"https://docs\\.rsshub\\.app/routes/game#beng-huai-3-you-xi-gong-gao\">docs</a>","errorType":"exception","errorClass":null,"httpStatus":503,"severity":"warning","filePath":"lib/routes-deprecated/mihoyo/bh3.js","lineNumber":32,"sourceCode":"    },\n    notice: {\n        id: '173',\n        title: '公告',\n    },\n    activity: {\n        id: '174',\n        title: '活动',\n    },\n    strategy: {\n        id: '175',\n        title: '补给',\n    },\n};\n\nmodule.exports = async (ctx) => {\n    const cfg = config[ctx.params.type];\n    if (!cfg) {\n        throw new Error(`Bad type: ${ctx.params.type}. See <a href=\"https://docs.rsshub.app/routes/game#beng-huai-3-you-xi-gong-gao\">docs</a>`);\n    }\n\n    const response = await got({\n        method: 'get',\n        url: rootUrl + cfg.id,\n    });\n\n    const list = response.data.data.list.map((item) => ({\n        title: item.title,\n        link: `https://www.bh3.com/news/${item.contentId}`,\n        pubDate: new Date(item.start_time).toUTCString(),\n    }));\n\n    ctx.state.data = {\n        title: `崩坏3作战资讯 - ${cfg.title}`,\n        link: `https://www.bh3.com/news/cate/${cfg.id}`,\n        item: await Promise.all(\n            list.map((item) =>","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes-deprecated/mihoyo/bh3.js#L14-L50","documentation":"Thrown by the Honkai 3rd (崩坏3) mihoyo route (deprecated) when :type is not a config key. Config maps slugs (e.g. activity 活动 id 174, strategy 补给 id 175) to numeric category ids appended to rootUrl. The message interpolates the bad value. Miss throws before the API call.","triggerScenarios":"Request with a :type not in config; config[ctx.params.type] is undefined → throw with the offending value in the message.","commonSituations":"Slug typo, using a type valid for another mihoyo game route (e.g. Genshin) that is not defined here, or the bh3 news portal changing its category ids.","solutions":["Use a documented slug such as activity (活动) or strategy (补给).","Read the config map at the top of lib/routes-deprecated/mihoyo/bh3.js for all keys/ids.","If the throw passes but the list is empty, the numeric id on the bh3 portal likely changed."],"exampleFix":"// before\nGET /mihoyo/bh3/aktiviti   // typo\n// after\nGET /mihoyo/bh3/activity    // 活动 (id 174)","handlingStrategy":"validation","validationCode":"const VALID = ['activity', 'strategy' /* + see config in lib/routes-deprecated/mihoyo/bh3.js */];\nif (!VALID.includes(ctx.params.type)) throw new Error(`Bad type '${ctx.params.type}'. Valid: ${VALID.join(', ')}`);","typeGuard":"const isType = (v: string): v is 'activity' | 'strategy' => ['activity', 'strategy'].includes(v);","tryCatchPattern":"try { await fetch(route); }\ncatch (e) {\n  if (/Bad type:/.test(e.message)) listTypes();\n  else if (/Cannot read prop.*list/.test(String(e))) reportCategoryIdChange();\n  else throw e;\n}","preventionTips":["Numeric ids in config drift when bh3 reorganizes its portal.","Don't borrow type slugs from other mihoyo game routes."],"tags":["rsshub","parameter-validation","deprecated-route","game"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}