DIYgod/RSSHub · warning
参数不在可选范围之内
Error message
参数不在可选范围之内
What it means
Thrown by the Guilin University of Electronic Technology news route (deprecated) when :type (default 'gdyw') is not a key of the infos map (keys include zbgs 招标公示, xshd 学术活动). Same Chinese 'parameter out of range' message; throws before the got request.
Source
Thrown at lib/routes-deprecated/guet/news.js:47
},
tzgg: {
path: '/xwzx/tzgg.htm',
title: '通知公告',
},
zbgs: {
path: '/xwzx/zbgs.htm',
title: '招标公示',
},
xshd: {
path: '/xwzx/xshd.htm',
title: '学术活动',
},
};
module.exports = async (ctx) => {
const type = ctx.params.type || 'gdyw';
if (!infos[type]) {
throw new Error('参数不在可选范围之内');
}
const path = infos[type].path.slice(1);
const response = await got(path, {
prefixUrl: host,
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('tr[id^="line"]').find('a');
const item = await Promise.all(
list
.map(async (index, element) => {
const href = $(element).attr('href');
const path = href && href.replace(/\.\./, '');
const link = host + path;
const item = await ctx.cache.tryGet(link, async () => {View on GitHub (pinned to bed535e087)
Solutions
- Use a documented type slug (e.g. gdyw, zbgs, xshd).
- Confirm keys against the infos map at the top of lib/routes-deprecated/guet/news.js.
- Do not mix slugs between guet and guat routes.
Example fix
// before GET /guet/news/zhaobiao // not a key // after GET /guet/news/zbgs // 招标公示
Defensive patterns
Strategy: validation
Validate before calling
const VALID = ['gdyw', 'zbgs', 'xshd' /* see infos in lib/routes-deprecated/guet/news.js */];
const type = ctx.params.type || 'gdyw';
if (!VALID.includes(type)) throw new Error(`参数非法. Valid: ${VALID.join(', ')}`); Type guard
const isType = (v: string): v is 'gdyw' | 'zbgs' | 'xshd' => ['gdyw', 'zbgs', 'xshd'].includes(v);
Try / catch
try { await fetch(route); }
catch (e) { if (/参数不在可选范围之内/.test(e.message)) listTypes(); else throw e; } Prevention
- Default 'gdyw' applies when omitted.
- Path strips a leading '/', so only registered keys resolve.
When it happens
Trigger: Request with a :type segment not in infos; `if (!infos[type])` throws.
Common situations: Slug typo, or confusing this university's slugs with guat (Guilin Aerospace) slugs which look similar. The path is built by stripping a leading '/', so even valid-looking strings won't resolve if not a key.
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/d179ada656f166ef.
Report an issue: GitHub.