{"record":{"id":"fab1f7b4c1d180cc","repo":"DIYgod/RSSHub","slug":"invalid-category-id-categoryid","errorCode":null,"errorMessage":"Invalid category Id: ${categoryId}","messagePattern":"Invalid category Id: (.+?)","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/acfun/article.ts","lineNumber":98,"sourceCode":"    maintainers: ['TonyRL'],\n    handler,\n    description: `| 二次元画师 | 综合 | 生活情感 | 游戏 | 动漫文化 | 漫画文学 |\n| ---------- | ---- | -------- | ---- | -------- | -------- |\n| 184        | 110  | 73       | 164  | 74       | 75       |\n\n| 最新发表   | 最新动态        | 最热文章 |\n| ---------- | --------------- | -------- |\n| createTime | lastCommentTime | hotScore |\n\n| 时间不限 | 24 小时 | 三天     | 一周    | 一个月   |\n| -------- | ------- | -------- | ------- | -------- |\n| all      | oneDay  | threeDay | oneWeek | oneMonth |`,\n};\n\nasync function handler(ctx) {\n    const { categoryId, sortType = 'createTime', timeRange = 'all' } = ctx.req.param();\n    if (!Object.hasOwn(categoryMap, categoryId)) {\n        throw new InvalidParameterError(`Invalid category Id: ${categoryId}`);\n    }\n    if (!sortTypeEnum.has(sortType)) {\n        throw new InvalidParameterError(`Invalid sort type: ${sortType}`);\n    }\n    if (!timeRangeEnum.has(timeRange)) {\n        throw new InvalidParameterError(`Invalid time range: ${timeRange}`);\n    }\n\n    const url = `${baseUrl}/v/list${categoryId}/index.htm`;\n    const response = await got.post(\n        `${baseUrl}/rest/pc-direct/article/feed?cursor=first_page&onlyOriginal=false&limit=10&sortType=${sortType}&timeRange=${sortType === 'hotScore' ? timeRange : 'all'}&${categoryMap[categoryId].realmId}`,\n        {\n            headers: {\n                referer: url,\n            },\n        }\n    );\n","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/acfun/article.ts#L80-L116","documentation":"The Acfun article route only supports six category IDs (184, 110, 73, 164, 74, 75) — each maps to a realmId list used to build the feed API URL. Object.hasOwn(categoryMap, categoryId) rejects unknown IDs before the request.","triggerScenarios":"Calling /acfun/article/:categoryId where categoryId is not one of {184, 110, 73, 164, 74, 75} — e.g. an Acfun video channel ID, a realmId, or a string.","commonSituations":"Confusing the article category with an Acfun video channel ID; passing a realmId (e.g. 'realmId=18') instead of the top-level ID.","solutions":["Use one of the supported IDs: 184 (二次元画师), 110 (综合), 73 (生活情感), 164 (游戏), 74 (动漫文化), 75 (漫画文学).","Omit sortType/timeRange if you only want the default feed; the example is /acfun/article/110."],"exampleFix":"// before\n/acfun/article/realmId=18   // realmId, not the category ID\n// after\n/acfun/article/184","handlingStrategy":"validation","validationCode":"const ACFUN_CATEGORIES = new Set(['184','110','73','164','74','75']);\nfunction validAcfunCategory(id) {\n  return ACFUN_CATEGORIES.has(String(id));\n}","typeGuard":"function isAcfunCategoryId(id): id is '184'|'110'|'73'|'164'|'74'|'75' {\n  return ['184','110','73','164','74','75'].includes(String(id));\n}","tryCatchPattern":null,"preventionTips":["Use the top-level article category ID, never a realmId.","Coerce to string before the hasOwn check.","Document the six IDs in your caller config so they cannot drift from the route."],"tags":["validation","parameter","enum","rsshub"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}