DIYgod/RSSHub · warning · InvalidParameterError

type not supported

Error message

type not supported

What it means

InvalidParameterError thrown by the UESTC 成电青年 (cqe) route when ctx.req.param('type') does not map to a key in mapUrl. The route supports only two categories (hdyg 活动预告, tzgg 通知公告); any other path segment for :type is rejected before launching the Playwright browser, saving a costly headless fetch.

Source

Thrown at lib/routes/uestc/cqe.ts:52

        {
            source: ['cqe.uestc.edu.cn/'],
            target: '/cqe',
        },
    ],
    name: '文化素质教育中心',
    maintainers: ['truobel', 'mobyw'],
    handler,
    url: 'cqe.uestc.edu.cn/',
    description: `| 活动预告 | 通知公告 |
| -------- | -------- |
| hdyg     | tzgg     |`,
};

async function handler(ctx) {
    const type = ctx.req.param('type') || 'tzgg';
    const pageUrl = mapUrl[type];
    if (!pageUrl) {
        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 + pageUrl, {
        waitUntil: 'networkidle',
    });
    const content = await page.content();
    await context.close();

    const $ = load(content);

    const items = $('div.Newslist li');

View on GitHub (pinned to bed535e087)

Solutions

  1. Use only 'hdyg' or 'tzgg' as the :type path parameter (or omit it to default to 'tzgg').
  2. Check the route description table in the source for the current valid slugs.
  3. Update any saved feed URLs that reference retired slugs.

Example fix

// before
// /uestc/cqe/news
// after
// /uestc/cqe/tzgg   (or /uestc/cqe/hdyg)
Defensive patterns

Strategy: type-guard

Validate before calling

const CQE_TYPES = new Set(['hdyg', 'tzgg']);
function isValidCqeType(t: string | undefined): boolean {
  return t === undefined || CQE_TYPES.has(t);
}

Type guard

function isCqeType(type: string): type is 'hdyg' | 'tzgg' {
  return type === 'hdyg' || type === 'tzgg';
}

Prevention

When it happens

Trigger: Requesting /uestc/cqe/<type> with a type other than 'hdyg' or 'tzgg'. Default is 'tzgg' so it also fires if mapUrl is edited to remove a key that a feed URL still references.

Common situations: User guessed a category slug; documentation link pointed at an old slug that was renamed; route description table was misread.

Related errors


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