{"record":{"id":"f823193e52da8eb8","repo":"DIYgod/RSSHub","slug":"invalid-sort-type-sorttype","errorCode":null,"errorMessage":"Invalid sort type: ${sortType}","messagePattern":"Invalid sort type: (.+?)","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/acfun/article.ts","lineNumber":101,"sourceCode":"| ---------- | ---- | -------- | ---- | -------- | -------- |\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\n    const list = response.data.data.map((item) => ({\n        title: item.title,\n        link: `${baseUrl}/a/ac${item.articleId}`,","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/acfun/article.ts#L83-L119","documentation":"Acfun article feed accepts exactly three sortType values — createTime, lastCommentTime, hotScore — checked against a Set. Anything else is rejected before the API call.","triggerScenarios":"Calling /acfun/article/<id>/<sortType> with sortType not in {createTime, lastCommentTime, hotScore} (case-sensitive).","commonSituations":"Passing a translated label ('最新发表'); typo ('creatTime'); using an Acfun-internal sort code instead of the slug.","solutions":["Use one of: createTime, lastCommentTime, hotScore.","Omit sortType to accept the default 'createTime'."],"exampleFix":"// before\n/acfun/article/110/最新发表\n// after\n/acfun/article/110/createTime","handlingStrategy":"validation","validationCode":"const ACFUN_SORT = new Set(['createTime','lastCommentTime','hotScore']);\nfunction validAcfunSort(s) {\n  return ACFUN_SORT.has(s);\n}","typeGuard":"function isAcfunSortType(s): s is 'createTime'|'lastCommentTime'|'hotScore' {\n  return ['createTime','lastCommentTime','hotScore'].includes(s);\n}","tryCatchPattern":null,"preventionTips":["Match the literal English slug, case-sensitive.","Omit sortType to accept the createTime default rather than guessing.","Avoid passing localized labels ('最新发表') through to 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"}