DIYgod/RSSHub · warning · InvalidParameterError

type not supported

Error message

type not supported

What it means

InvalidParameterError thrown by the UESTC 信通 (sise) route when ctx.req.param('type') (defaulted to 1) does not map to a divId in mapId (keys 1–9). Because the default is numeric and the check uses mapId[type] truthiness, a non-numeric or out-of-range type (including a string that does not coerce to a key) is rejected before Playwright is launched.

Source

Thrown at lib/routes/uestc/sise.ts:67

        {
            source: ['sise.uestc.edu.cn/'],
            target: '/sise',
        },
    ],
    name: '信息与软件工程学院',
    maintainers: ['Yadomin', 'mobyw'],
    handler,
    url: 'sise.uestc.edu.cn/',
    description: `| 最新 | 院办 | 学生科 | 教务科 | 研管科 | 组织 | 人事 | 实践教育中心 | Int'I |
| ---- | ---- | ------ | ------ | ------ | ---- | ---- | ------------ | ----- |
| 1    | 2    | 3      | 4      | 5      | 6    | 7    | 8            | 9     |`,
};

async function handler(ctx) {
    const type = ctx.req.param('type') || 1;
    const divId = mapId[type];
    if (!divId) {
        throw new InvalidParameterError('type not supported');
    }

    const context = await playwright();
    const page = await context.newPage();
    await page.route('**/*', (route) => {
        const request = route.request();
        request.resourceType() === 'document' || request.resourceType() === 'script' ? route.continue() : route.abort();
    });
    await page.goto(baseUrl, {
        waitUntil: 'networkidle',
    });
    const content = await page.content();
    await context.close();

    const $ = load(content);

    const items = $(`div[id="${divId}"] p.news-item`);

View on GitHub (pinned to bed535e087)

Solutions

  1. Use an integer from 1 to 9 (see the description table for the section each maps to).
  2. Omit :type to default to 1.
  3. Update feed URLs that pass names instead of numbers.

Example fix

// before
// /uestc/sise/yuanban
// after
// /uestc/sise/2
Defensive patterns

Strategy: validation

Validate before calling

const SISE_MAX = 9;
function isValidSiseType(t: string | undefined): boolean {
  if (t === undefined) return true;
  const n = Number(t);
  return Number.isInteger(n) && n >= 1 && n <= SISE_MAX;
}

Type guard

function isSiseType(t: string): t is `${1|2|3|4|5|6|7|8|9}` {
  const n = Number(t); return Number.isInteger(n) && n >= 1 && n <= 9;
}

Prevention

When it happens

Trigger: Requesting /uestc/sise/<type> with a value outside 1..9, or a non-numeric string. Default 1 (最新) is valid, so the error requires an explicit bad value.

Common situations: User passed a category name string instead of the numeric id; out-of-range number; stale URL using an old numbering scheme.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/e7fa58159d925d3a. Report an issue: GitHub.