{"record":{"id":"59352c4a4475f054","repo":"DIYgod/RSSHub","slug":"pattern-not-matched","errorCode":null,"errorMessage":"pattern not matched","messagePattern":"pattern not matched","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"warning","filePath":"lib/routes/gov/suzhou/news.ts","lineNumber":124,"sourceCode":"            title = '苏州市政府 - 区县专题';\n            break;\n        case 'zwgg':\n            apiUrl = `${rootUrl}/szinf/info/getInfoCommon/?pagesize=15&currpage=1&channelid=260915178a1f4c4fac44c4bf6378c9b0`;\n            url = `${rootUrl}/szsrmzf/zwgg/nav_list.shtml`;\n            title = '苏州市政府 - 政务公告';\n            break;\n        case 'mszx':\n            apiUrl = `${rootUrl}/szinf/info/getInfoCommon/?pagesize=15&currpage=1&channelid=dc60acecb0be46b89d42272dcb8bd32b`;\n            url = `${rootUrl}/szsrmzf/mszx/nav_list.shtml`;\n            title = '苏州市政府 - 便民公告';\n            break;\n        case 'bmzx':\n            apiUrl = `${rootUrl}/szinf/info/getInfoCommon/?pagesize=15&currpage=1&channelid=b015bfa5e5514cc9a26cd9f956ef8e69`;\n            url = `${rootUrl}/szsrmzf/bmzx/bmzx_list.shtml`;\n            title = '苏州市政府 - 民生资讯';\n            break;\n        default:\n            throw new InvalidParameterError('pattern not matched');\n    }\n    if (apiUrl) {\n        const response = await got(apiUrl);\n        const infoList = response.data.infolist.map((item) => ({\n            title: item.title,\n            link: item.link.startsWith('http') ? item.link : new URL(item.link, rootUrl).href,\n            pubDate: timezone(parseDate(item.pubtime, 'YYYY-MM-DD HH:mm:ss'), 8),\n        }));\n\n        items = await Promise.all(\n            infoList.map((item) =>\n                // 获取全文\n                cache.tryGet(item.link, async () => {\n                    const response = await got(item.link);\n                    const $ = load(response.data);\n                    item.description = $('ucapcontent').html();\n\n                    return item;","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/gov/suzhou/news.ts#L106-L142","documentation":"Thrown by the Suzhou government news route when the `:uid` path parameter does not match any `case` in the handler's `switch` statement (lines 65–125). Each case corresponds to a known channel slug such as `news`, `qxkx`, `bmdt`, `rdzt`, `zwgg`, etc. The `default` branch throws `InvalidParameterError` (HTTP 400) with the message 'pattern not matched'.","triggerScenarios":"Requesting `/gov/suzhou/news/<uid>` where `<uid>` does not match any `case` label in the handler's `switch` statement. Each case corresponds to a known channel slug; any other value falls through to the `default` branch.","commonSituations":"User enters a channel slug not in the switch (e.g. `sports`, `finance`), uses an old slug that was removed, or mistypes a valid one like `qxkx` as `qxk`. The route description lists all valid slugs in two markdown tables.","solutions":["Consult the route description table for the full list of valid `:uid` values: `news`/`szyw`, `qxkx`/`district`, `bmdt`, `xwsp`, `rdzt`, `sbjzt`, `zxrdzt`, `wqzt`, `qxzt`, `zwgg`, `mszx`, `bmzx`.","Use one of those exact slugs in the URL path."],"exampleFix":"// before (broken)\n// GET /gov/suzhou/news/sports\n\n// after (correct)\n// GET /gov/suzhou/news/bmdt","handlingStrategy":"validation","validationCode":"const VALID_UIDS = ['news', 'szyw', 'qxkx', 'district', 'bmdt', 'xwsp', 'rdzt', 'sbjzt', 'zxrdzt', 'wqzt', 'qxzt', 'zwgg', 'mszx', 'bmzx'] as const;\nfunction isValidUid(uid: string): boolean {\n    return (VALID_UIDS as readonly string[]).includes(uid);\n}","typeGuard":"function isKnownSuzhouChannel(uid: string): uid is typeof VALID_UIDS[number] {\n    return (VALID_UIDS as readonly string[]).includes(uid);\n}","tryCatchPattern":null,"preventionTips":["Keep the route description markdown table in sync with the switch cases.","Consider extracting the valid UIDs into a shared constant used by both validation and the switch.","Use `InvalidParameterError` consistently for parameter validation."],"tags":["parameter-validation","user-input","rsshub","government"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}