{"record":{"id":"4293248fafdce7b0","repo":"DIYgod/RSSHub","slug":"invalid-general-ranking-type-type","errorCode":null,"errorMessage":"Invalid general ranking type: ${type}","messagePattern":"Invalid general ranking type: (.+?)","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/syosetu/ranking.ts","lineNumber":192,"sourceCode":"        },\n        {\n            source: ['yomou.syosetu.com/rank/isekailist/type/:type'],\n            target: '/ranking/isekai/:type',\n        },\n        ...getBest5RadarItems(),\n    ],\n};\n\nfunction parseGeneralRankingType(type: string): { period: RankingPeriod; novelType: NovelType } {\n    const [periodStr, novelTypeStr] = type.split('_', 2);\n\n    const period = periodStr as RankingPeriod;\n    const novelType = novelTypeStr as NovelType;\n\n    const isValid = [Object.values(RankingPeriod).includes(period), Object.values(NovelType).includes(novelType)].every(Boolean);\n\n    if (!isValid) {\n        throw new InvalidParameterError(`Invalid general ranking type: ${type}`);\n    }\n\n    return { period, novelType };\n}\n\nfunction parseGenreRankingType(type: string): { period: RankingPeriod; genre: number; novelType: NovelType } {\n    const [periodStr, genreStr, novelTypeStr = NovelType.TOTAL] = type.split('_', 3);\n\n    const period = periodStr as RankingPeriod;\n    const genre = Number(genreStr) as Genre;\n    const novelType = novelTypeStr as NovelType;\n\n    const isValid = [Object.values(RankingPeriod).includes(period), Object.values(Genre).includes(genre), Object.values(NovelType).includes(novelType), genre !== Genre.SonotaReplay, genre !== Genre.NonGenre].every(Boolean);\n\n    if (!isValid) {\n        throw new InvalidParameterError(`Invalid genre ranking type: ${type}`);\n    }\n","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/syosetu/ranking.ts#L174-L210","documentation":"Thrown by parseGeneralRankingType (syosetu/ranking.ts:192) as an InvalidParameterError when the general-list `type` (format period_novelType) has an invalid component. Valid periods (RankingPeriod): daily, weekly, monthly, quarter, yearly, total. Valid novelTypes (NovelType): total, t, r, er. Unlike the genre/isekai parsers, novelType has NO default here — it must be present. Reached via /syosetu/ranking/list/<type>.","triggerScenarios":"Wrong segment order; unknown period or novelType; missing novelType (e.g. bare 'daily' throws); passing a three-segment genre/isekai type like daily_2_total into the list route.","commonSituations":"Mixing up the three sub-formats across listType values; assuming novelType is optional (it is for genre/isekai, not for list).","solutions":["Use exactly <period>_<novelType> (e.g. daily_total, weekly_r, monthly_er).","Do not include a category/genre segment — use the 'genre' or 'isekai' listType for those formats."],"exampleFix":"// before (list type takes only period_novelType, no category)\nGET /syosetu/ranking/list/daily_2_total\n// after\nGET /syosetu/ranking/list/daily_total","handlingStrategy":"validation","validationCode":"import { RankingPeriod, NovelType } from './types/ranking';\n\nconst PERIODS = Object.values(RankingPeriod);\nconst NOVEL_TYPES = Object.values(NovelType);\n\nfunction isValidGeneralListType(type: string): boolean {\n  const [p, n] = type.split('_', 2);\n  return PERIODS.includes(p as RankingPeriod)\n    && NOVEL_TYPES.includes(n as NovelType); // novelType is required for list\n}","typeGuard":"function isGeneralRankingType(type: string): boolean {\n  const [p, n] = type.split('_', 2);\n  return ['daily','weekly','monthly','quarter','yearly','total'].includes(p)\n    && ['total','t','r','er'].includes(n);\n}","tryCatchPattern":null,"preventionTips":["Use exactly two segments <period>_<novelType> for the list route — novelType is mandatory here.","Do not include a genre/category segment; switch to listType=genre or listType=isekai for those.","Pick values from the route's auto-generated parameters.type.options."],"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"}