DIYgod/RSSHub · error · InvalidParameterError
invalid type
Error message
invalid type
What it means
Thrown by the USTC SIST (School of Information Science and Technology) route when the `type` path parameter is not found in the internal `map`. The valid types are `tzgg` (通知公告) and `zsgz` (招生工作). This is an `InvalidParameterError` (HTTP 400), indicating the user supplied an unsupported type code.
Source
Thrown at lib/routes/ustc/sist.ts:49
{
source: ['sist.ustc.edu.cn/'],
target: '/sist',
},
],
name: '信息科学技术学院',
maintainers: ['jasongzy'],
handler,
url: 'sist.ustc.edu.cn/',
description: `| 通知公告 | 招生工作 |
| -------- | -------- |
| tzgg | zsgz |`,
};
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);
let items = $('div[portletmode=simpleList]')
.find('div.card')
.toArray()
.map((item): DataItem => {
const $item = $(item);
const title = $item.find('.card-title > a').attr('title');
let link = $item.find('.card-title > a').attr('href');
link = link!.startsWith('/') ? host + link : link;
const pubDate = timezone(parseDate($item.find('time').text().replace('发布时间:', ''), 'YYYY-MM-DD'), 8);
return {
title: title!,
pubDate,
link,View on GitHub (pinned to bed535e087)
Solutions
- Use `tzgg` or `zsgz` as the type parameter.
- Omit the type to default to `tzgg`: `/ustc/sist`.
- Refer to the route's description table for the authoritative list of valid types.
Example fix
// before GET /ustc/sist/xyxw // after GET /ustc/sist/tzgg
Defensive patterns
Strategy: validation
Validate before calling
const VALID_TYPES = ['tzgg', 'zsgz'];
if (!VALID_TYPES.includes(type)) {
throw new InvalidParameterError(`Invalid type: ${type}. Valid types: ${VALID_TYPES.join(', ')}`);
} Type guard
function isValidSistType(type: string): type is 'tzgg' | 'zsgz' {
return ['tzgg', 'zsgz'].includes(type);
} Prevention
- Check the route description table for the two valid type codes.
- Include the valid options in the error message so users can self-correct.
When it happens
Trigger: A request to `/ustc/sist/:type` where `:type` is neither `tzgg` nor `zsgz`. The parameter defaults to `tzgg` when omitted.
Common situations: Using a type code valid for a different USTC sub-route (e.g. `xyxw` from the math route) but not defined here, or a typo in the two-letter abbreviation.
Related errors
- invalid type
- No topic named ${topic}
- 该公众号不存在,有关如何获取公众号 id,详见 https://docs.rsshub.app/routes/new-m
- 不支持指定类型!
- 不支持指定类型!
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/426620d15ab57bd6.
Report an issue: GitHub.