{"record":{"id":"426620d15ab57bd6","repo":"DIYgod/RSSHub","slug":"invalid-type-426620","errorCode":null,"errorMessage":"invalid type","messagePattern":"invalid type","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"error","filePath":"lib/routes/ustc/sist.ts","lineNumber":49,"sourceCode":"        {\n            source: ['sist.ustc.edu.cn/'],\n            target: '/sist',\n        },\n    ],\n    name: '信息科学技术学院',\n    maintainers: ['jasongzy'],\n    handler,\n    url: 'sist.ustc.edu.cn/',\n    description: `| 通知公告 | 招生工作 |\n| -------- | -------- |\n| tzgg     | zsgz     |`,\n};\n\nasync function handler(ctx) {\n    const type = ctx.req.param('type') ?? 'tzgg';\n    const info = map.get(type);\n    if (!info) {\n        throw new InvalidParameterError('invalid type');\n    }\n    const id = info.id;\n\n    const response = await got(`${host}/${id}/list.htm`);\n    const $ = load(response.data);\n    let items = $('div[portletmode=simpleList]')\n        .find('div.card')\n        .toArray()\n        .map((item): DataItem => {\n            const $item = $(item);\n            const title = $item.find('.card-title > a').attr('title');\n            let link = $item.find('.card-title > a').attr('href');\n            link = link!.startsWith('/') ? host + link : link;\n            const pubDate = timezone(parseDate($item.find('time').text().replace('发布时间：', ''), 'YYYY-MM-DD'), 8);\n            return {\n                title: title!,\n                pubDate,\n                link,","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/ustc/sist.ts#L31-L67","documentation":"Thrown by the USTC SIST (School of Information Science and Technology) route when the `type` path parameter is not found in the internal `map`. The valid types are `tzgg` (通知公告) and `zsgz` (招生工作). This is an `InvalidParameterError` (HTTP 400), indicating the user supplied an unsupported type code.","triggerScenarios":"A request to `/ustc/sist/:type` where `:type` is neither `tzgg` nor `zsgz`. The parameter defaults to `tzgg` when omitted.","commonSituations":"Using a type code valid for a different USTC sub-route (e.g. `xyxw` from the math route) but not defined here, or a typo in the two-letter abbreviation.","solutions":["Use `tzgg` or `zsgz` as the type parameter.","Omit the type to default to `tzgg`: `/ustc/sist`.","Refer to the route's description table for the authoritative list of valid types."],"exampleFix":"// before\nGET /ustc/sist/xyxw\n// after\nGET /ustc/sist/tzgg","handlingStrategy":"validation","validationCode":"const VALID_TYPES = ['tzgg', 'zsgz'];\nif (!VALID_TYPES.includes(type)) {\n    throw new InvalidParameterError(`Invalid type: ${type}. Valid types: ${VALID_TYPES.join(', ')}`);\n}","typeGuard":"function isValidSistType(type: string): type is 'tzgg' | 'zsgz' {\n    return ['tzgg', 'zsgz'].includes(type);\n}","tryCatchPattern":null,"preventionTips":["Check the route description table for the two valid type codes.","Include the valid options in the error message so users can self-correct."],"tags":["parameter-validation","invalid-parameter","ustc","rss-route","map-lookup"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}