DIYgod/RSSHub · error · InvalidParameterError

This type does not exist. Please refer to the documentation

Error message

This type does not exist. Please refer to the documentation for the correct usage.

What it means

The AHSTU (安徽科技学院) route maps seven column slugs (akyw, tzgg, xsak, xydt, mtak, rwfc, sjxy) to section URLs. Object.hasOwn(types, type) rejects anything else before the request.

Source

Thrown at lib/routes/ahstu/index.ts:58

    name: '官网通知与新闻',
    maintainers: ['JizzCruiy'],
    handler,
    description: `| 栏目     | type |
| -------- | ---- |
| 安科要闻 | akyw |
| 通知公告 | tzgg |
| 学术安科 | xsak |
| 校园动态 | xydt |
| 媒体聚焦 | mtak |
| 人物风采 | rwfc |
| 视觉校园 | sjxy |`,
};

async function handler(ctx) {
    const type = ctx.req.param('type') ?? 'akyw';

    if (!Object.hasOwn(types, type)) {
        throw new InvalidParameterError('This type does not exist. Please refer to the documentation for the correct usage.');
    }

    const listUrl = `${baseUrl}${types[type].url}`;
    const listResponse = await ofetch(listUrl);
    const $ = load(listResponse);

    // rwfc is an image gallery layout without dates; other columns use a text list layout
    const isGallery = types[type].gallery === true;
    const listSelector = isGallery ? 'a.img-ul-tt' : 'a.rigthConBox-conList';

    const list = $(listSelector)
        .toArray()
        .map((item): DataItem => {
            const $item = $(item);
            const result: DataItem = {
                title: isGallery ? $item.text().trim() : $item.find('.conListWord').text().trim(),
                link: new URL($item.attr('href')!, baseUrl).href,
            };

View on GitHub (pinned to bed535e087)

Solutions

  1. Use one of the seven documented slugs: akyw, tzgg, xsak, xydt, mtak, rwfc, sjxy.
  2. Omit the segment to default to 'akyw'.

Example fix

// before
/ahstu/通知公告
// after
/ahstu/tzgg
Defensive patterns

Strategy: validation

Validate before calling

const AHSTU_TYPES = new Set(['akyw','tzgg','xsak','xydt','mtak','rwfc','sjxy']);
function validAhstuType(t) {
  return AHSTU_TYPES.has(t);
}

Type guard

function isAhstuType(t): t is 'akyw'|'tzgg'|'xsak'|'xydt'|'mtak'|'rwfc'|'sjxy' {
  return ['akyw','tzgg','xsak','xydt','mtak','rwfc','sjxy'].includes(t);
}

Prevention

When it happens

Trigger: Calling /ahstu/:type with a slug outside {akyw, tzgg, xsak, xydt, mtak, rwfc, sjxy} — typo, Chinese label instead of slug, or a column the site retired.

Common situations: Passing the Chinese column name ('通知公告'); typo ('tak' for 'mtak'); upstream reorganised columns.

Related errors


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