DIYgod/RSSHub · warning · InvalidParameterError
invalid type
Error message
invalid type
What it means
InvalidParameterError('invalid type') thrown by the USTC 研究生院 (gs) route when ctx.req.param('type') is not in the map (a Map<string, {id,...}>). Supported types: tzgg (通知公告), xwdt (新闻动态); default 'tzgg'.
Source
Thrown at lib/routes/ustc/gs.ts:49
{
source: ['gradschool.ustc.edu.cn/'],
target: '/gs',
},
],
name: '研究生院',
maintainers: ['jasongzy'],
handler,
url: 'gradschool.ustc.edu.cn/',
description: `| 通知公告 | 新闻动态 |
| -------- | -------- |
| tzgg | xwdt |`,
};
async function handler(ctx) {
const type = ctx.req.param('type') ?? 'tzgg';
const info = map.get(type);
if (!info) {
throw new InvalidParameterError('invalid type');
}
const id = info.id;
const response = await got(`${host}/column/${id}`);
const $ = load(response.data);
let items = $('div.r-box > ul')
.find('li')
.toArray()
.map((item): DataItem => {
const $item = $(item);
const title = $item.find('a').text();
const link = $item.find('a').attr('href')!.startsWith('/article') ? host + $item.find('a').attr('href') : $item.find('a').attr('href');
const pubDate = timezone(parseDate($item.find('time').text(), 'YYYY-MM-DD'), 8);
return {
title,
pubDate,
link,
};View on GitHub (pinned to bed535e087)
Solutions
- Use 'tzgg' or 'xwdt'.
- Omit :type to default to 'tzgg'.
- Update saved feed URLs.
Example fix
// before // /ustc/gs/news // after // /ustc/gs/xwdt
Defensive patterns
Strategy: type-guard
Validate before calling
const GS_TYPES = new Set(['tzgg', 'xwdt']);
function isValidGsType(t: string | undefined): boolean {
return t === undefined || GS_TYPES.has(t);
} Type guard
type GsType = 'tzgg' | 'xwdt';
function isGsType(t: string): t is GsType { return t === 'tzgg' || t === 'xwdt'; } Prevention
- Use 'tzgg' or 'xwdt' exactly.
- Do not reuse slugs from sibling USTC routes without checking.
- Omit :type to default to 'tzgg'.
When it happens
Trigger: Requesting /ustc/gs/<type> with a slug other than 'tzgg' or 'xwdt'.
Common situations: Slug typo; reused a slug from a different USTC sub-route that does not apply here; stale bookmark.
Related errors
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/13bd88758979ff3f.
Report an issue: GitHub.