DIYgod/RSSHub · warning · InvalidParameterError
type not supported
Error message
type not supported
What it means
InvalidParameterError thrown by the UESTC 研究生院 (gr) route when ctx.req.param('type') is not an own property of typeUrlMap. Supported types are important, teaching, degree, student, practice; Object.hasOwn() is used so inherited keys cannot bypass the check.
Source
Thrown at lib/routes/uestc/gr.ts:63
radar: [
{
source: ['gr.uestc.edu.cn/'],
},
],
name: '研究生院',
maintainers: ['huyyi', 'mobyw'],
handler,
url: 'gr.uestc.edu.cn/',
description: `\
| 重要公告 | 教学管理 | 学位管理 | 学生管理 | 就业实践 |
| --------- | -------- | -------- | -------- | -------- |
| important | teaching | degree | student | practice |`,
};
async function handler(ctx: Context): Promise<Data> {
const type = ctx.req.param('type') || 'important';
if (!Object.hasOwn(typeUrlMap, type)) {
throw new InvalidParameterError('type not supported');
}
const typeName = typeNameMap[type];
const indexContent = await ofetch(baseUrl + typeUrlMap[type]);
const $ = load(indexContent);
const entries = $('div.title').toArray();
const items = entries.map(async (entry) => {
const element = $(entry);
const newsTitle = element.find('a').text();
const newsLink = detailUrl + element.find('a').attr('href');
const newsDetail = await cache.tryGet(newsLink, async () => {
const newsContent = await ofetch(newsLink);
const content = load(newsContent);
const basicInfo = content('div.topic_detail_header').find('div.info').text();View on GitHub (pinned to bed535e087)
Solutions
- Use one of: important, teaching, degree, student, practice.
- Omit :type to default to 'important'.
- Update saved feed URLs to the current slugs.
Example fix
// before // /uestc/gr/xuewei // after // /uestc/gr/degree
Defensive patterns
Strategy: type-guard
Validate before calling
const GR_TYPES = new Set(['important', 'teaching', 'degree', 'student', 'practice']);
function isValidGrType(t: string | undefined): boolean {
return t === undefined || GR_TYPES.has(t);
} Type guard
type GrType = 'important' | 'teaching' | 'degree' | 'student' | 'practice';
function isGrType(t: string): t is GrType { return GR_TYPES.has(t); } Prevention
- Use the documented English slugs exactly.
- Centralize the slug list so UI/feed builders cannot drift from the route.
- Default to 'important' when unsure.
When it happens
Trigger: Requesting /uestc/gr/<type> with a slug outside the five supported values. Default is 'important', so the error implies an explicit bad value was supplied.
Common situations: User inferred a slug from the Chinese category names but did not match the documented English key; renamed slug; stale bookmark.
Related errors
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/dfed19994b81b963.
Report an issue: GitHub.