{"record":{"id":"2053c73d42d744a8","repo":"DIYgod/RSSHub","slug":"invalid-time-range-timerange","errorCode":null,"errorMessage":"Invalid time range: ${timeRange}","messagePattern":"Invalid time range: (.+?)","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/acfun/article.ts","lineNumber":104,"sourceCode":"| 最新发表   | 最新动态        | 最热文章 |\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}`,\n        author: item.userName,\n        pubDate: parseDate(item.createTime, 'x'),\n        category: item.realmName,","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/acfun/article.ts#L86-L122","documentation":"Acfun article feed accepts five timeRange values (all, oneDay, threeDay, oneWeek, oneMonth) checked against a Set. Note timeRange is only meaningfully applied by upstream when sortType='hotScore'; for other sort types the handler forces 'all'.","triggerScenarios":"Calling /acfun/article/<id>/<sortType>/<timeRange> with timeRange not in {all, oneDay, threeDay, oneWeek, oneMonth} (case-sensitive).","commonSituations":"Passing a localized label ('一周'); typo ('oneweek'); snake_case instead of camelCase.","solutions":["Use one of: all, oneDay, threeDay, oneWeek, oneMonth (camelCase).","Omit timeRange to accept the default 'all'.","Remember timeRange only has effect when sortType='hotScore'."],"exampleFix":"// before\n/acfun/article/110/hotScore/one_week\n// after\n/acfun/article/110/hotScore/oneWeek","handlingStrategy":"validation","validationCode":"const ACFUN_RANGE = new Set(['all','oneDay','threeDay','oneWeek','oneMonth']);\nfunction validAcfunRange(r) {\n  return ACFUN_RANGE.has(r);\n}","typeGuard":"function isAcfunTimeRange(r): r is 'all'|'oneDay'|'threeDay'|'oneWeek'|'oneMonth' {\n  return ['all','oneDay','threeDay','oneWeek','oneMonth'].includes(r);\n}","tryCatchPattern":null,"preventionTips":["Use camelCase slugs — 'oneWeek', not 'one_week' or 'oneweek'.","Remember timeRange only affects the feed when sortType='hotScore'.","Omit the segment to accept the 'all' default."],"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"}