DIYgod/RSSHub · error · InvalidParameterError
此分类不存在
Error message
此分类不存在
What it means
An `InvalidParameterError` at lib/routes/wnacg/common.tsx:37 when the `cid` path parameter is provided but is not a key in the `categories` object. Valid keys are: 1, 2, 3, 5, 6, 7, 9, 10, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22 (note gaps at 4, 8, 11, 15 — these are intentionally absent). The check uses `Object.keys(categories).includes(cid)` where keys are strings, matching the string `cid` from the route param.
Source
Thrown at lib/routes/wnacg/common.tsx:37
10: '雜誌&短篇 漢化',
12: '同人誌 日語',
13: '單行本 日語',
14: '雜誌&短篇 日語',
16: '同人誌 English',
17: '單行本 English',
18: '雜誌&短篇 English',
19: '韓漫',
20: '韓漫 漢化',
21: '韓漫 生肉',
22: '同人誌 3D漫畫',
};
const baseUrl = 'https://www.wnacg.com';
export async function handler(ctx) {
const { cid, tag } = ctx.req.param();
if (cid && !Object.keys(categories).includes(cid)) {
throw new InvalidParameterError('此分类不存在');
}
const url = `${baseUrl}/albums${cid ? `-index-cate-${cid}` : ''}${tag ? `-index-tag-${tag}` : ''}.html`;
const { data } = await got(url);
const $ = load(data);
const list = $('.gallary_item')
.toArray()
.map((item): DataItem & { link: string; aid: string } => {
const $item = $(item);
const href = $item.find('a').attr('href');
const aid = href!.match(/^\/photos-index-aid-(\d+)\.html$/)![1];
return {
title: $item.find('a').attr('title')!,
link: `${baseUrl}${href}`,
pubDate: parseDate(
$item
.find('.info_col')View on GitHub (pinned to bed535e087)
Solutions
- Use one of the documented valid cid values listed in the categories object (1,2,3,5,6,7,9,10,12,13,14,16,17,18,19,20,21,22).
- Omit cid entirely to get the default/all albums listing.
- If a category was newly added on wnacg.com, add it to the `categories` map in common.tsx.
Defensive patterns
Strategy: validation
Validate before calling
const validCids = ['1', '2', '3', '5', '6', '7', '9', '10', '12', '13', '14', '16', '17', '18', '19', '20', '21', '22'];
if (cid && !validCids.includes(cid)) {
throw new InvalidParameterError(`Invalid category id. Valid: ${validCids.join(', ')}`);
} Type guard
const isValidWnacgCid = (cid: string): boolean =>
['1', '2', '3', '5', '6', '7', '9', '10', '12', '13', '14', '16', '17', '18', '19', '20', '21', '22'].includes(cid); Prevention
- Note the gaps in category ids (4, 8, 11, 15 are not valid).
- Omit cid to get the default listing.
- If wnacg.com adds new categories, update the categories map in common.tsx.
When it happens
Trigger: Passing `cid=4`, `cid=8`, `cid=11`, or `cid=15` (the gap numbers); passing any number outside 1–22; passing a non-numeric cid; URL path encoding issues.
Common situations: User tries sequential category numbers and hits a gap; user guesses a category id; site renumbered categories but the route's hardcoded map wasn't updated.
Related errors
- Invalid parameter brief. Please check the doc https://docs.r
- Unknown category: ${category}. Valid: ${Object.keys(category
- 未找到 ${placeName} 的疫情数据,请检查输入的省市名称是否正确
- Category "${categorySlug}" not found
- Invalid city
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/c910be57f9485abc.
Report an issue: GitHub.