{"record":{"id":"ada6e252d748e9b2","repo":"DIYgod/RSSHub","slug":"invalid-ranking-type-type-ada6e2","errorCode":null,"errorMessage":"Invalid ranking type: ${type}","messagePattern":"Invalid ranking type: (.+?)","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/syosetu/ranking.ts","lineNumber":259,"sourceCode":"\n        case RankingType.GENRE: {\n            const { period, genre, novelType } = parseGenreRankingType(type);\n            rankingUrl = `https://yomou.syosetu.com/rank/genrelist/type/${type}`;\n            rankingTitle = `[${periodToJapanese[period]}] ${GenreNotation[genre]}ランキング - ${novelTypeToJapanese[novelType]} BEST${limit}`;\n\n            searchParams.order = periodToOrder[period];\n            searchParams.genre = genre as Genre;\n            if (novelType !== NovelType.TOTAL) {\n                searchParams.type = novelType;\n            }\n            break;\n        }\n\n        case RankingType.ISEKAI:\n            return handleIsekaiRanking(type, limit);\n\n        default:\n            throw new InvalidParameterError(`Invalid ranking type: ${type}`);\n    }\n\n    const builder = new SearchBuilder(searchParams, api);\n    const result = await builder.execute();\n\n    const items = result.values.map((novel, index) => ({\n        title: `#${index + 1} ${novel.title}`,\n        link: `https://ncode.syosetu.com/${String(novel.ncode).toLowerCase()}`,\n        description: renderDescription({ novel }),\n        author: novel.writer,\n        category: novel.keyword.split(/[\\s/\\u{FF0F}]/u).filter(Boolean),\n    }));\n\n    return {\n        title: `小説家になろう - ${rankingTitle}`,\n        link: rankingUrl,\n        item: items as DataItem[],\n        language: 'ja',","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/syosetu/ranking.ts#L241-L277","documentation":"Thrown by syosetu/ranking.ts:259 as an InvalidParameterError in the default arm of the rankingType switch, when the `listType` path param is not 'list', 'genre', or 'isekai' (RankingType enum, types/ranking.ts:17). Reached via /syosetu/ranking/<listType>/<type>. Minor diagnostic wart: the message echoes `type` (the second segment) rather than `listType` (the actual offending value), which can mislead during debugging.","triggerScenarios":"/syosetu/ranking/<listType>/<type> with listType not in {list, genre, isekai}: typos like 'lists', 'genere', 'isekait', or a pluralized/uppercase variant.","commonSituations":"Guessing the listType; copy-paste typo; using a value valid in a different syosetu route.","solutions":["Use exactly list, genre, or isekai (lowercase) as the listType segment.","Cross-check with the route example: /syosetu/ranking/list/daily_total?limit=50."],"exampleFix":"// before\nGET /syosetu/ranking/genere/daily_101_total\n// after\nGET /syosetu/ranking/genre/daily_101_total","handlingStrategy":"validation","validationCode":"import { RankingType } from './types/ranking';\n\nfunction isValidListType(listType: string): boolean {\n  return Object.values(RankingType).includes(listType as RankingType);\n}","typeGuard":"import { RankingType } from './types/ranking';\n\nfunction isRankingType(listType: string): listType is RankingType {\n  return ['list', 'genre', 'isekai'].includes(listType);\n}","tryCatchPattern":null,"preventionTips":["Use listType in {list, genre, isekai}, lowercase.","Note the error message echoes `type` not `listType` — debug the first path segment when this fires.","Cross-check with the route example: /syosetu/ranking/list/daily_total?limit=50."],"tags":["invalid-parameter","enum","syosetu","ranking"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}