DIYgod/RSSHub · warning
Bad type: ${ctx.params.type}. See <a href="https://docs.rssh
Error message
Bad type: ${ctx.params.type}. See <a href="https://docs.rsshub.app/routes/game#beng-huai-3-you-xi-gong-gao">docs</a> What it means
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.
Source
Thrown at lib/routes-deprecated/mihoyo/bh3.js:32
},
notice: {
id: '173',
title: '公告',
},
activity: {
id: '174',
title: '活动',
},
strategy: {
id: '175',
title: '补给',
},
};
module.exports = async (ctx) => {
const cfg = config[ctx.params.type];
if (!cfg) {
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>`);
}
const response = await got({
method: 'get',
url: rootUrl + cfg.id,
});
const list = response.data.data.list.map((item) => ({
title: item.title,
link: `https://www.bh3.com/news/${item.contentId}`,
pubDate: new Date(item.start_time).toUTCString(),
}));
ctx.state.data = {
title: `崩坏3作战资讯 - ${cfg.title}`,
link: `https://www.bh3.com/news/cate/${cfg.id}`,
item: await Promise.all(
list.map((item) =>View on GitHub (pinned to bed535e087)
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.
Example fix
// before GET /mihoyo/bh3/aktiviti // typo // after GET /mihoyo/bh3/activity // 活动 (id 174)
Defensive patterns
Strategy: validation
Validate before calling
const VALID = ['activity', 'strategy' /* + see config in lib/routes-deprecated/mihoyo/bh3.js */];
if (!VALID.includes(ctx.params.type)) throw new Error(`Bad type '${ctx.params.type}'. Valid: ${VALID.join(', ')}`); Type guard
const isType = (v: string): v is 'activity' | 'strategy' => ['activity', 'strategy'].includes(v);
Try / catch
try { await fetch(route); }
catch (e) {
if (/Bad type:/.test(e.message)) listTypes();
else if (/Cannot read prop.*list/.test(String(e))) reportCategoryIdChange();
else throw e;
} Prevention
- Numeric ids in config drift when bh3 reorganizes its portal.
- Don't borrow type slugs from other mihoyo game routes.
When it happens
Trigger: Request with a :type not in config; config[ctx.params.type] is undefined → throw with the offending value in the message.
Common situations: 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.
Related errors
- Bad category. See <a href="https://docs.rsshub.app/routes/go
- Bad category. See <a href="https://docs.rsshub.app/routes/go
- Nanjing, Cannot find page
- Bad category. See <a href="https://docs.rsshub.app/routes/go
- Bad category. See <a href="https://docs.rsshub.app/routes/go
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/5a1a669205fb3b2c.
Report an issue: GitHub.