DIYgod/RSSHub · warning
参数不在可选范围之内
Error message
参数不在可选范围之内
What it means
Thrown by the Guilin University of Aerospace Technology news route (deprecated) when the :type param (default 'ghyw') is not a key of the urls map (keys include ghyw, xxgk 信息公开, ghdjt 桂航大讲堂). The Chinese message means 'parameter is not within the selectable range'.
Source
Thrown at lib/routes-deprecated/guat/news.js:38
},
tzgg: {
url: `${host}/index/tzgg.htm`,
title: '通知公告',
},
xxgk: {
url: `${host}/index/xxgk.htm`,
title: '信息公开',
},
ghdjt: {
url: `${host}/index/ghdjt.htm`,
title: '桂航大讲堂',
},
};
module.exports = async (ctx) => {
const type = ctx.params.type || 'ghyw';
if (!urls[type]) {
throw new Error('参数不在可选范围之内');
}
const url = urls[type].url;
const title = urls[type].title;
const response = await got({
method: 'get',
url,
});
const data = response.data;
const $ = cheerio.load(data);
const list = [];
// 适应桂航的奇葩规则
for (let index = 0; index < 19; index++) {
const element = $(`#line_u8_${index}`);
const item_title = element.find('a').first().text();
const item_link = element.find('a').first().attr('href').replace('../', host);
list.push({View on GitHub (pinned to bed535e087)
Solutions
- Use a documented type slug (e.g. ghyw, xxgk, ghdjt).
- Read the urls map at the top of lib/routes-deprecated/guat/news.js for accepted keys.
- Note the default 'ghyw' applies when the param is omitted.
Example fix
// before GET /guat/news/xxgkk // typo // after GET /guat/news/xxgk // 信息公开
Defensive patterns
Strategy: validation
Validate before calling
const VALID = ['ghyw', 'xxgk', 'ghdjt' /* see urls in lib/routes-deprecated/guat/news.js */];
const type = ctx.params.type || 'ghyw';
if (!VALID.includes(type)) throw new Error(`参数非法. Valid: ${VALID.join(', ')}`); Type guard
const isType = (v: string): v is 'ghyw' | 'xxgk' | 'ghdjt' => ['ghyw', 'xxgk', 'ghdjt'].includes(v);
Try / catch
try { await fetch(route); }
catch (e) { if (/参数不在可选范围之内/.test(e.message)) listTypes(); else throw e; } Prevention
- Default 'ghyw' applies when omitted — leverage that.
- Don't confuse guat (航天) with guet (电子) slugs.
When it happens
Trigger: Request with a :type segment absent from urls; the `if (!urls[type])` guard throws.
Common situations: Slug typo, using a type from a different university's route, or stale docs after the site renamed a column .htm file.
Related errors
- 参数不在可选范围之内
- Bad category. See <a href="https://docs.rsshub.app/routes/go
- Bad category. See <a href="https://docs.rsshub.app/routes/go
- Nanjing, Cannot find page
- Bad category. See <a href="https://docs.rsshub.app/routes/go
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/b1b4e42db21b7f95.
Report an issue: GitHub.