DIYgod/RSSHub · warning · InvalidParameterError
invalid type
Error message
invalid type
What it means
InvalidParameterError('invalid type') thrown by the USTC 院系 (eeis) route when ctx.req.param('type') does not resolve to an entry in the map (a Map<string, {id,...}>). Supported types: tzgg (通知公告), xwxx (新闻信息); default 'tzgg'. The check uses map.get(type) truthiness.
Source
Thrown at lib/routes/ustc/eeis.ts:49
{
source: ['eeis.ustc.edu.cn/'],
target: '/eeis',
},
],
name: '电子工程与信息科学系',
maintainers: ['jasongzy'],
handler,
url: 'eeis.ustc.edu.cn/',
description: `| 通知公告 | 新闻信息 |
| -------- | -------- |
| tzgg | xwxx |`,
};
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}/${id}/list.htm`);
const $ = load(response.data);
const list = $('div[portletmode=simpleList]')
.find('article')
.toArray()
.map((item): DataItem => {
const $item = $(item);
const title = $item.find('h4 > a').eq(1).attr('title')!.trim();
let link = $item.find('h4 > a').attr('href');
link = link!.startsWith('/') ? host + link : link;
const pubDate = timezone(parseDate($item.find('.post-date > time').text().replace('发布时间:', ''), 'YYYY-MM-DD'), 8);
return {
title,
pubDate,
link,View on GitHub (pinned to bed535e087)
Solutions
- Use 'tzgg' or 'xwxx'.
- Omit :type to default to 'tzgg'.
- Update stale feed URLs.
Example fix
// before // /ustc/eeis/notice // after // /ustc/eeis/tzgg
Defensive patterns
Strategy: type-guard
Validate before calling
const EEIS_TYPES = new Set(['tzgg', 'xwxx']);
function isValidEeisType(t: string | undefined): boolean {
return t === undefined || EEIS_TYPES.has(t);
} Type guard
type EeisType = 'tzgg' | 'xwxx';
function isEeisType(t: string): t is EeisType { return t === 'tzgg' || t === 'xwxx'; } Prevention
- Use 'tzgg' or 'xwxx' exactly.
- Omit :type to default to 'tzgg'.
- Cross-check against the route description table when building feed URLs.
When it happens
Trigger: Requesting /ustc/eeis/<type> with a slug other than 'tzgg' or 'xwxx'.
Common situations: Slug typo; guessed slug; retired slug referenced by an old feed URL.
Related errors
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/28d054218fd94863.
Report an issue: GitHub.