{"record":{"id":"af61be528a4a7fe9","repo":"DIYgod/RSSHub","slug":"error-af61be","errorCode":null,"errorMessage":"未知的游戏！","messagePattern":"未知的游戏！","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/mihoyo/bbs/img-ranking.ts","lineNumber":112,"sourceCode":"| 插画         | 漫画  | Q 版 | 手工   |\n| ------------ | ----- | ---- | ------ |\n| illustration | comic | qute | manual |\n\n排行榜类型\n\n| 日榜  | 周榜   | 月榜    |\n| ----- | ------ | ------- |\n| daily | weekly | monthly |`,\n};\n\nasync function handler(ctx) {\n    const game = ctx.req.param('game');\n    const routeParams = Object.fromEntries(new URLSearchParams(ctx.req.param('routeParams')));\n    const { forumType: forum_type = 'tongren', cateType: cate_type, rankingType: ranking_type, lastId: last_id = '' } = routeParams;\n    const page_size = ctx.req.query('limit') || '20';\n    const { gids, title: game_title } = getGameInfo(game);\n    if (!gids) {\n        throw new Error('未知的游戏！');\n    }\n    const { forum_id, title: forum_title } = getForumInfo(game, forum_type);\n    if (!forum_id) {\n        throw new Error(`${game_title} 的排行榜不存在！`);\n    }\n    const { cate_id, title: cate_title } = getCateInfo(game, forum_type, cate_type);\n    const { id: type, title: type_title } = getRankingTypeInfo(game, ranking_type);\n    const query = new URLSearchParams({\n        gids,\n        forum_id,\n        cate_id,\n        type,\n        page_size,\n        last_id,\n    }).toString();\n    const url = `https://bbs-api.miyoushe.com/post/wapi/getImagePostList?${query}`;\n    const response = await got({\n        method: 'get',","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/mihoyo/bbs/img-ranking.ts#L94-L130","documentation":"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.","triggerScenarios":"getGameInfo(game) returns gids undefined because DATA_MAP[game] is undefined. This is a pure validation failure on the user-supplied game abbreviation.","commonSituations":"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.","solutions":["Use one of the documented abbreviations: bh3, ys, bh2, wd, sr, dby, zzz.","Copy the abbreviation from the route's example/parameters table.","Check for typos and case — keys are lowercase.","If you need a game not in the list, the route does not support it."],"exampleFix":"// before\n// /mihoyo/bbs/img-ranking/genshin/...\n\n// after\n// /mihoyo/bbs/img-ranking/ys/...","handlingStrategy":"validation","validationCode":"const VALID_GAMES = ['bh3','ys','bh2','wd','sr','dby','zzz'];\nif (!VALID_GAMES.includes(game)) {\n    throw new Error(`Unknown game '${game}'. Use one of: ${VALID_GAMES.join(', ')}`);\n}","typeGuard":"function isSupportedGame(game: string): game is 'bh3'|'ys'|'bh2'|'wd'|'sr'|'dby'|'zzz' {\n    return ['bh3','ys','bh2','wd','sr','dby','zzz'].includes(game);\n}","tryCatchPattern":null,"preventionTips":["Publish the supported abbreviations in route docs.","Validate at the route boundary with a TypeScript union type.","Surface the valid set in the error message."],"tags":["mihoyo","validation","user-input"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}