{"record":{"id":"997fbcf997c686cc","repo":"DIYgod/RSSHub","slug":"invalid-state-state","errorCode":null,"errorMessage":"Invalid state '${state}'","messagePattern":"Invalid state '(.+?)'","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":400,"severity":"warning","filePath":"lib/routes/people/liuyan.ts","lineNumber":74,"sourceCode":"    },\n    name: '领导留言板',\n    maintainers: ['nczitzk', 'pseudoyu'],\n    handler,\n    url: 'liuyan.people.com.cn/',\n    description: `| 全部 | 待回复 | 办理中 | 已办理 |\n| ---- | ------ | ------ | ------ |\n| 1    | 2      | 3      | 4      |`,\n};\n\nasync function handler(ctx) {\n    const fid = ctx.req.param('id');\n    if (!/^\\d+$/.test(fid)) {\n        throw new InvalidParameterError(`Invalid forum id '${fid}'`);\n    }\n\n    const state = ctx.req.param('state') ?? '1';\n    if (!allowedStates.has(state)) {\n        throw new InvalidParameterError(`Invalid state '${state}'`);\n    }\n\n    const limit = Number(ctx.req.query('limit') ?? 30);\n    const forumUrl = `${rootUrl}/threads/list?fid=${fid}`;\n    const currentUrl = `${forumUrl}#state=${state}`;\n    const apiResponse = await ofetch<ApiResponse>(apiUrl, {\n        method: 'POST',\n        responseType: 'json',\n        headers: {\n            Referer: forumUrl,\n        },\n        body: new URLSearchParams({\n            fid,\n            state,\n            lastItem: '0',\n        }),\n    });\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/people/liuyan.ts#L56-L92","documentation":"Thrown as an `InvalidParameterError` when the `state` path parameter for the People's Daily message board route is not in the `allowedStates` set. Valid states are: '1' (全部/all), '2' (待回复/pending reply), '3' (办理中/in progress), '4' (已办理/resolved). The handler defaults to '1' if no state is provided.","triggerScenarios":"Requesting `/people/liuyan/<id>/<state>` with a state value not in {1, 2, 3, 4} (e.g., '0', '5', 'all', 'pending'). The state parameter is optional and defaults to '1'.","commonSituations":"User passes a descriptive string instead of the numeric code. User guesses a state number outside the supported range. User passes '0' expecting it to mean 'all' (the actual 'all' value is '1').","solutions":["Use only state values 1 (全部), 2 (待回复), 3 (办理中), or 4 (已办理).","Omit the state parameter entirely to default to '1' (全部/all).","Refer to the route description table in `lib/routes/people/liuyan.ts` for the state mapping."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate state against allowed set\nconst allowedStates = new Set(['1', '2', '3', '4']);\nif (!allowedStates.has(state)) {\n    throw new InvalidParameterError(\n        `Invalid state '${state}'. Must be one of: 1 (全部), 2 (待回复), 3 (办理中), 4 (已办理)`\n    );\n}","typeGuard":"function isValidMessageState(state: string): state is '1' | '2' | '3' | '4' {\n    return ['1', '2', '3', '4'].includes(state);\n}","tryCatchPattern":null,"preventionTips":["Use only state values 1, 2, 3, or 4.","Omit the state parameter to default to '1' (全部/all).","Remember that '1' means all, not '0'."],"tags":["validation","people","invalid-parameter","chinese-site","liuyan"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}