DIYgod/RSSHub · error · Error

未知的游戏!

Error message

未知的游戏!

What it means

Generic Error ('未知的游戏!' = 'Unknown game!') thrown when the :game path parameter does not match any key in DATA_MAP. The route only supports a fixed set of Miyoushe game abbreviations (bh3, ys, bh2, wd, sr, dby, zzz); anything else is rejected before any API call.

Source

Thrown at lib/routes/mihoyo/bbs/img-ranking.ts:112

| 插画         | 漫画  | Q 版 | 手工   |
| ------------ | ----- | ---- | ------ |
| illustration | comic | qute | manual |

排行榜类型

| 日榜  | 周榜   | 月榜    |
| ----- | ------ | ------- |
| daily | weekly | monthly |`,
};

async function handler(ctx) {
    const game = ctx.req.param('game');
    const routeParams = Object.fromEntries(new URLSearchParams(ctx.req.param('routeParams')));
    const { forumType: forum_type = 'tongren', cateType: cate_type, rankingType: ranking_type, lastId: last_id = '' } = routeParams;
    const page_size = ctx.req.query('limit') || '20';
    const { gids, title: game_title } = getGameInfo(game);
    if (!gids) {
        throw new Error('未知的游戏!');
    }
    const { forum_id, title: forum_title } = getForumInfo(game, forum_type);
    if (!forum_id) {
        throw new Error(`${game_title} 的排行榜不存在!`);
    }
    const { cate_id, title: cate_title } = getCateInfo(game, forum_type, cate_type);
    const { id: type, title: type_title } = getRankingTypeInfo(game, ranking_type);
    const query = new URLSearchParams({
        gids,
        forum_id,
        cate_id,
        type,
        page_size,
        last_id,
    }).toString();
    const url = `https://bbs-api.miyoushe.com/post/wapi/getImagePostList?${query}`;
    const response = await got({
        method: 'get',

View on GitHub (pinned to bed535e087)

Solutions

  1. Use one of the documented abbreviations: bh3, ys, bh2, wd, sr, dby, zzz.
  2. Copy the abbreviation from the route's example/parameters table.
  3. Check for typos and case — keys are lowercase.
  4. If you need a game not in the list, the route does not support it.

Example fix

// before
// /mihoyo/bbs/img-ranking/genshin/...

// after
// /mihoyo/bbs/img-ranking/ys/...
Defensive patterns

Strategy: validation

Validate before calling

const VALID_GAMES = ['bh3','ys','bh2','wd','sr','dby','zzz'];
if (!VALID_GAMES.includes(game)) {
    throw new Error(`Unknown game '${game}'. Use one of: ${VALID_GAMES.join(', ')}`);
}

Type guard

function isSupportedGame(game: string): game is 'bh3'|'ys'|'bh2'|'wd'|'sr'|'dby'|'zzz' {
    return ['bh3','ys','bh2','wd','sr','dby','zzz'].includes(game);
}

Prevention

When it happens

Trigger: getGameInfo(game) returns gids undefined because DATA_MAP[game] is undefined. This is a pure validation failure on the user-supplied game abbreviation.

Common situations: Typo in the game abbreviation (e.g. 'genshin' instead of 'ys'); using the full game name instead of the abbreviation; using an unsupported game; case mismatch.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/af61be528a4a7fe9. Report an issue: GitHub.