{"record":{"id":"85d3aa09c48a2904","repo":"DIYgod/RSSHub","slug":"unknown-region-region-85d3aa","errorCode":null,"errorMessage":"Unknown region: ${region}","messagePattern":"Unknown region: (.+?)","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/yahoo/news/provider.ts","lineNumber":46,"sourceCode":"    maintainers: ['TonyRL', 'williamgateszhao'],\n    handler,\n    description: `\\`Region\\`\n\n| 香港 | 台灣 |\n| ---- | ---- |\n| hk   | tw   |\n\n\\`ProviderId\\`\n\n除了可以通过路由 \"新聞來源列表\" 获得外，也可通过 hk.news.yahoo.com/archive 和 tw\\\\.news.yahoo.com/archive 选择 \"新闻来源\" 后通过页面 Url 来获得。\n\n例如 hk.news.yahoo.com/yahoo\\\\_movies\\\\_hk\\\\_660-- 所有分類 /archive, \\`yahoo_movies_hk_660\\` 就是 ProviderId 。`,\n};\n\nasync function handler(ctx) {\n    const { region, providerId } = ctx.req.param();\n    if (!['hk', 'tw'].includes(region)) {\n        throw new InvalidParameterError(`Unknown region: ${region}`);\n    }\n\n    const limit = ctx.req.query('limit') ? Number(ctx.req.query('limit')) : 20;\n    const providerList = await getProviderList(region);\n    const provider = providerList.find((p) => p.key === providerId);\n\n    const response = await getArchive(region, limit, [], providerId);\n    const list = parseList(region, response);\n\n    const items = await Promise.all(list.map((item) => parseItem(item)));\n\n    return {\n        title: `Yahoo 新聞 - ${provider?.title ?? ''}`,\n        link: provider?.link ?? `https://${region}.news.yahoo.com`,\n        image: 'https://s.yimg.com/cv/apiv2/social/images/yahoo_default_logo-1200x1200.png',\n        item: items,\n    };\n}","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/yahoo/news/provider.ts#L28-L64","documentation":"InvalidParameterError thrown by the Yahoo news provider handler when ctx.req.param('region') is not 'hk' or 'tw'. This route filters a region's archive by a specific providerId (e.g. yahoo_movies_hk_660), which is a HK/TW-only concept, so other regions are rejected before getProviderList/getArchive run.","triggerScenarios":"A request to /yahoo/news/provider/:region/:providerId with region outside hk/tw. The guard fires immediately after destructuring {region, providerId}.","commonSituations":"Caller used a US/other region with a providerId; assumed the provider concept is global; typo.","solutions":["Use 'hk' or 'tw' as the region segment.","Obtain a valid providerId from the provider-helper route (/yahoo/news/provider-list/hk) or from the archive page URL on hk/tw.news.yahoo.com."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function requireHkTwRegion(region: string) {\n    if (!['hk', 'tw'].includes(region)) {\n        throw new InvalidParameterError(`Unknown region: ${region}. Use hk or tw.`);\n    }\n}","typeGuard":"function isHkTwRegion(value: string): value is 'hk' | 'tw' {\n    return value === 'hk' || value === 'tw';\n}","tryCatchPattern":null,"preventionTips":["Obtain a valid providerId from the provider-helper route or the archive page URL.","Keep provider routes scoped to hk/tw."],"tags":["yahoo","validation","route-param","region","provider"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}