DIYgod/RSSHub · warning · InvalidParameterError
invalid type
Error message
invalid type
What it means
InvalidParameterError from the NJUST CWC (财务处) route. Same Map-lookup pattern as 412. Valid type keys are tzgg / bslc.
Source
Thrown at lib/routes/njust/cwc.ts:42
requirePuppeteer: true,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: '财务处',
maintainers: ['MilkShakeYoung', 'jasongzy'],
handler,
description: `| 通知公告 | 办事流程 |
| -------- | -------- |
| tzgg | bslc |`,
};
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 siteUrl = host + id + '/list.htm';
const html = await getContent(siteUrl, true);
const $ = load(html);
const list = $('ul.news_list').find('li');
return {
title: info.title,
link: siteUrl,
item: list.toArray().map((item) => ({
title: $(item).find('a').attr('title')!.trim(),
pubDate: timezone(parseDate($(item).find('span.news_meta').text(), 'YYYY-MM-DD'), 8),
link: $(item).find('a').attr('href'),
})),
};
}View on GitHub (pinned to bed535e087)
Solutions
- Use one of tzgg (通知公告) or bslc (办事流程) for this route.
- Refer to the route description table for valid codes.
- Remember each njust/* route has its own map.
Example fix
// before
const info = map.get(type);
if (!info) {
throw new InvalidParameterError('invalid type');
}
// after — caller: GET /njust/cwc/tzgg or /njust/cwc/bslc Defensive patterns
Strategy: validation
Validate before calling
const VALID = new Set(['tzgg','bslc']);
function buildNjustCwcUrl(type) {
if (!VALID.has(type)) throw new Error(`invalid type '${type}'. Valid: ${[...VALID].join(', ')}`);
return host + MAP[type] + '/list.htm';
} Type guard
const isCwcType = (t: string): t is 'tzgg'|'bslc' => VALID.has(t);
Prevention
- Use only tzgg / bslc for the CWC route.
- Treat each njust/* route's code set as independent.
- Validate before requesting to avoid a 400 round-trip.
When it happens
Trigger: Calling /njust/cwc/:type with a value not in the CWC map — typos or codes borrowed from another NJUST route.
Common situations: User assumes codes are uniform across NJUST routes; typo; outdated docs.
Related errors
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/f3a24e92dd843527.
Report an issue: GitHub.