{"record":{"id":"5ae8ea8fea561403","repo":"DIYgod/RSSHub","slug":"unsupported-region-region","errorCode":null,"errorMessage":"Unsupported region: ${region}","messagePattern":"Unsupported region: (.+?)","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/yahoo/news/listid.ts","lineNumber":46,"sourceCode":"    maintainers: ['TonyRL', 'williamgateszhao', 'tpnonthealps'],\n    handler,\n    description: `| 合作媒體 (\\`HK\\`) | \\`:listId\\`                              |\n| --------------- | -------------------------------------- |\n| 東方日報        | \\`33ddd580-0ab3-11e8-bfe1-4b555fb1e429\\` |\n| now\\\\.com        | \\`01b4d760-0ab4-11e8-af3a-54037d3dced3\\` |\n| am730           | \\`c4842090-0ab2-11e8-af7f-041a72ce7398\\` |\n| BBC             | \\`4d3fc9a0-fac8-11e9-87f2-564ca250983e\\` |\n| 信報財經新聞    | \\`5a8a0aa0-0ab3-11e8-b3dc-d990c79d6cb1\\` |\n| 香港電台        | \\`b4bfc2d0-0ab3-11e8-bf9f-c888fc09923f\\` |\n| 法新社          | \\`1cc44280-facb-11e9-ad7c-f3ba971275c8\\` |\n| Bloomberg       | \\`40023670-facc-11e9-9dde-9175ff306602\\` |\n| 香港動物報      | \\`6058fa9c-d74d-487a-8b49-aa99a2a2978e\\` |`,\n};\n\nasync function handler(ctx) {\n    const { region, listId } = ctx.req.param();\n    if (!['hk', 'tw'].includes(region)) {\n        throw new InvalidParameterError(`Unsupported region: ${region}`);\n    }\n\n    const response = await getList(region, listId);\n\n    // console.log('Response:', response.stream_items);\n    // console.log('Type of response:', typeof response.stream_items);\n    // console.log('Is response an array?', Array.isArray(response.stream_items));\n    const list = parseList(region, response.stream_items);\n\n    const items = await Promise.all(list.map((item) => parseItem(item)));\n\n    const author = items[0].author;\n    const atIndex = author?.indexOf('@'); // fing '@'\n    const source = atIndex === -1 ? author : author?.slice(atIndex + 1).trim();\n    // console.log(source);\n\n    return {\n        title: `Yahoo 新聞 - ${source ?? ''}`,","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/yahoo/news/listid.ts#L28-L64","documentation":"InvalidParameterError thrown by the Yahoo news listid handler when ctx.req.param('region') is not 'hk' or 'tw'. The listId-based endpoint is only implemented for Hong Kong and Taiwan Yahoo (the markets whose archive uses stream listIds), so other regions are rejected before getList is called.","triggerScenarios":"A request to /yahoo/news/listid/:region/:listId where region is e.g. 'au', 'sg', 'us', or any non-hk/tw value. The destructure `const { region, listId } = ctx.req.param()` reads both, then the includes() guard fires.","commonSituations":"Caller used the generic /yahoo/news region list on this listid-specific route; assumed listId works for all Yahoo regions; typo.","solutions":["Use 'hk' or 'tw' as the region segment for the listid route.","For other regions, use the main /yahoo/news/:region/:category route instead."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function requireListidRegion(region: string) {\n    if (!['hk', 'tw'].includes(region)) {\n        throw new InvalidParameterError(`Unsupported region: ${region}. The listid route supports only hk and tw.`);\n    }\n}","typeGuard":"function isListidRegion(value: string): value is 'hk' | 'tw' {\n    return value === 'hk' || value === 'tw';\n}","tryCatchPattern":null,"preventionTips":["Use the general /yahoo/news route for non-hk/tw regions.","Document clearly that listId is a HK/TW-only concept."],"tags":["yahoo","validation","route-param","region"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}