DIYgod/RSSHub · error · InvalidParameterError
Invalid category Id: ${categoryId}
Error message
Invalid category Id: ${categoryId} What it means
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.
Source
Thrown at lib/routes/acfun/article.ts:98
maintainers: ['TonyRL'],
handler,
description: `| 二次元画师 | 综合 | 生活情感 | 游戏 | 动漫文化 | 漫画文学 |
| ---------- | ---- | -------- | ---- | -------- | -------- |
| 184 | 110 | 73 | 164 | 74 | 75 |
| 最新发表 | 最新动态 | 最热文章 |
| ---------- | --------------- | -------- |
| createTime | lastCommentTime | hotScore |
| 时间不限 | 24 小时 | 三天 | 一周 | 一个月 |
| -------- | ------- | -------- | ------- | -------- |
| all | oneDay | threeDay | oneWeek | oneMonth |`,
};
async function handler(ctx) {
const { categoryId, sortType = 'createTime', timeRange = 'all' } = ctx.req.param();
if (!Object.hasOwn(categoryMap, categoryId)) {
throw new InvalidParameterError(`Invalid category Id: ${categoryId}`);
}
if (!sortTypeEnum.has(sortType)) {
throw new InvalidParameterError(`Invalid sort type: ${sortType}`);
}
if (!timeRangeEnum.has(timeRange)) {
throw new InvalidParameterError(`Invalid time range: ${timeRange}`);
}
const url = `${baseUrl}/v/list${categoryId}/index.htm`;
const response = await got.post(
`${baseUrl}/rest/pc-direct/article/feed?cursor=first_page&onlyOriginal=false&limit=10&sortType=${sortType}&timeRange=${sortType === 'hotScore' ? timeRange : 'all'}&${categoryMap[categoryId].realmId}`,
{
headers: {
referer: url,
},
}
);
View on GitHub (pinned to bed535e087)
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.
Example fix
// before /acfun/article/realmId=18 // realmId, not the category ID // after /acfun/article/184
Defensive patterns
Strategy: validation
Validate before calling
const ACFUN_CATEGORIES = new Set(['184','110','73','164','74','75']);
function validAcfunCategory(id) {
return ACFUN_CATEGORIES.has(String(id));
} Type guard
function isAcfunCategoryId(id): id is '184'|'110'|'73'|'164'|'74'|'75' {
return ['184','110','73','164','74','75'].includes(String(id));
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Confusing the article category with an Acfun video channel ID; passing a realmId (e.g. 'realmId=18') instead of the top-level ID.
Related errors
- Bad timeRange range. See <a href="https://docs.rsshub.app/ro
- This category does not exist. Please refer to the documentat
- Invalid sort type: ${sortType}
- Invalid time range: ${timeRange}
- This type does not exist. Please refer to the documentation
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/fab1f7b4c1d180cc.
Report an issue: GitHub.