DIYgod/RSSHub · error · InvalidParameterError
Invalid ranking type: ${type}
Error message
Invalid ranking type: ${type} What it means
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.
Source
Thrown at lib/routes/syosetu/ranking.ts:259
case RankingType.GENRE: {
const { period, genre, novelType } = parseGenreRankingType(type);
rankingUrl = `https://yomou.syosetu.com/rank/genrelist/type/${type}`;
rankingTitle = `[${periodToJapanese[period]}] ${GenreNotation[genre]}ランキング - ${novelTypeToJapanese[novelType]} BEST${limit}`;
searchParams.order = periodToOrder[period];
searchParams.genre = genre as Genre;
if (novelType !== NovelType.TOTAL) {
searchParams.type = novelType;
}
break;
}
case RankingType.ISEKAI:
return handleIsekaiRanking(type, limit);
default:
throw new InvalidParameterError(`Invalid ranking type: ${type}`);
}
const builder = new SearchBuilder(searchParams, api);
const result = await builder.execute();
const items = result.values.map((novel, index) => ({
title: `#${index + 1} ${novel.title}`,
link: `https://ncode.syosetu.com/${String(novel.ncode).toLowerCase()}`,
description: renderDescription({ novel }),
author: novel.writer,
category: novel.keyword.split(/[\s/\u{FF0F}]/u).filter(Boolean),
}));
return {
title: `小説家になろう - ${rankingTitle}`,
link: rankingUrl,
item: items as DataItem[],
language: 'ja',View on GitHub (pinned to bed535e087)
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.
Example fix
// before GET /syosetu/ranking/genere/daily_101_total // after GET /syosetu/ranking/genre/daily_101_total
Defensive patterns
Strategy: validation
Validate before calling
import { RankingType } from './types/ranking';
function isValidListType(listType: string): boolean {
return Object.values(RankingType).includes(listType as RankingType);
} Type guard
import { RankingType } from './types/ranking';
function isRankingType(listType: string): listType is RankingType {
return ['list', 'genre', 'isekai'].includes(listType);
} Prevention
- 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.
When it happens
Trigger: /syosetu/ranking/<listType>/<type> with listType not in {list, genre, isekai}: typos like 'lists', 'genere', 'isekait', or a pluralized/uppercase variant.
Common situations: Guessing the listType; copy-paste typo; using a value valid in a different syosetu route.
Related errors
- Invalid isekai ranking type: ${type}
- Invalid ranking type: ${type}
- Invalid general ranking type: ${type}
- Invalid genre ranking type: ${type}
- Invalid subsite: ${sub}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/ada6e252d748e9b2.
Report an issue: GitHub.