{"record":{"id":"c910be57f9485abc","repo":"DIYgod/RSSHub","slug":"error-c910be","errorCode":null,"errorMessage":"此分类不存在","messagePattern":"此分类不存在","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"error","filePath":"lib/routes/wnacg/common.tsx","lineNumber":37,"sourceCode":"    10: '雜誌&短篇 漢化',\n    12: '同人誌 日語',\n    13: '單行本 日語',\n    14: '雜誌&短篇 日語',\n    16: '同人誌 English',\n    17: '單行本 English',\n    18: '雜誌&短篇 English',\n    19: '韓漫',\n    20: '韓漫 漢化',\n    21: '韓漫 生肉',\n    22: '同人誌 3D漫畫',\n};\n\nconst baseUrl = 'https://www.wnacg.com';\n\nexport async function handler(ctx) {\n    const { cid, tag } = ctx.req.param();\n    if (cid && !Object.keys(categories).includes(cid)) {\n        throw new InvalidParameterError('此分类不存在');\n    }\n\n    const url = `${baseUrl}/albums${cid ? `-index-cate-${cid}` : ''}${tag ? `-index-tag-${tag}` : ''}.html`;\n    const { data } = await got(url);\n    const $ = load(data);\n\n    const list = $('.gallary_item')\n        .toArray()\n        .map((item): DataItem & { link: string; aid: string } => {\n            const $item = $(item);\n            const href = $item.find('a').attr('href');\n            const aid = href!.match(/^\\/photos-index-aid-(\\d+)\\.html$/)![1];\n            return {\n                title: $item.find('a').attr('title')!,\n                link: `${baseUrl}${href}`,\n                pubDate: parseDate(\n                    $item\n                        .find('.info_col')","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/wnacg/common.tsx#L19-L55","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const validCids = ['1', '2', '3', '5', '6', '7', '9', '10', '12', '13', '14', '16', '17', '18', '19', '20', '21', '22'];\nif (cid && !validCids.includes(cid)) {\n    throw new InvalidParameterError(`Invalid category id. Valid: ${validCids.join(', ')}`);\n}","typeGuard":"const isValidWnacgCid = (cid: string): boolean =>\n    ['1', '2', '3', '5', '6', '7', '9', '10', '12', '13', '14', '16', '17', '18', '19', '20', '21', '22'].includes(cid);","tryCatchPattern":null,"preventionTips":["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."],"tags":["validation","parameters","nsfw","wnacg"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}