DIYgod/RSSHub · warning · InvalidParameterError

Invalid forum id '${fid}'

Error message

Invalid forum id '${fid}'

What it means

Thrown as an `InvalidParameterError` when the `id` path parameter (forum ID) for the People's Daily message board (领导留言板) route does not match the regex `/^\d+$/`. The forum ID must be a string of one or more digits only. The `fid` is used directly in API requests to `liuyan.people.com.cn`.

Source

Thrown at lib/routes/people/liuyan.ts:69

        requirePuppeteer: false,
        antiCrawler: false,
        supportBT: false,
        supportPodcast: false,
        supportScihub: false,
    },
    name: '领导留言板',
    maintainers: ['nczitzk', 'pseudoyu'],
    handler,
    url: 'liuyan.people.com.cn/',
    description: `| 全部 | 待回复 | 办理中 | 已办理 |
| ---- | ------ | ------ | ------ |
| 1    | 2      | 3      | 4      |`,
};

async function handler(ctx) {
    const fid = ctx.req.param('id');
    if (!/^\d+$/.test(fid)) {
        throw new InvalidParameterError(`Invalid forum id '${fid}'`);
    }

    const state = ctx.req.param('state') ?? '1';
    if (!allowedStates.has(state)) {
        throw new InvalidParameterError(`Invalid state '${state}'`);
    }

    const limit = Number(ctx.req.query('limit') ?? 30);
    const forumUrl = `${rootUrl}/threads/list?fid=${fid}`;
    const currentUrl = `${forumUrl}#state=${state}`;
    const apiResponse = await ofetch<ApiResponse>(apiUrl, {
        method: 'POST',
        responseType: 'json',
        headers: {
            Referer: forumUrl,
        },
        body: new URLSearchParams({
            fid,

View on GitHub (pinned to bed535e087)

Solutions

  1. Find the numeric forum ID from the corresponding person's page URL on liuyan.people.com.cn.
  2. Ensure the ID is purely numeric (digits only).
  3. Use the documented example `/people/liuyan/539` as a format reference.
Defensive patterns

Strategy: validation

Validate before calling

// Validate forum ID is numeric before use
if (!/^\d+$/.test(fid)) {
    throw new InvalidParameterError(`Invalid forum id '${fid}'. Must be numeric.`);
}

Type guard

function isValidForumId(fid: string): boolean {
    return /^\d+$/.test(fid);
}

Prevention

When it happens

Trigger: Requesting `/people/liuyan/<id>/<state>?` with an `id` containing non-digit characters (letters, symbols, spaces, decimals). Examples: `id='abc'`, `id='539a'`, `id='53.9'`. Note: the ID should be found in the person's page URL on liuyan.people.com.cn.

Common situations: User passes a URL slug or name instead of the numeric forum ID. User includes a leading slash or other separator. The ID was extracted incorrectly from the website URL.

Related errors


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