{"record":{"id":"733f414626cbcb3b","repo":"DIYgod/RSSHub","slug":"unknown-region-region-733f41","errorCode":null,"errorMessage":"Unknown region: ${region}","messagePattern":"Unknown region: (.+?)","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/yahoo/news/provider-helper.ts","lineNumber":35,"sourceCode":"        supportScihub: false,\n    },\n    radar: [\n        {\n            source: ['hk.news.yahoo.com/'],\n        },\n        {\n            source: ['tw.news.yahoo.com/'],\n        },\n    ],\n    name: '新聞來源列表',\n    maintainers: ['TonyRL', 'williamgateszhao'],\n    handler,\n};\n\nasync function handler(ctx) {\n    const region = ctx.req.param('region');\n    if (!['hk', 'tw'].includes(region)) {\n        throw new InvalidParameterError(`Unknown region: ${region}`);\n    }\n\n    const providerList = await getProviderList(region);\n\n    const items = providerList.map((provider) => ({\n        ...provider,\n        description: provider.key,\n    }));\n\n    return {\n        title: 'Yahoo 新聞 - 新聞來源列表',\n        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}\n","sourceCodeStart":17,"sourceCodeEnd":52,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/yahoo/news/provider-helper.ts#L17-L52","documentation":"InvalidParameterError thrown by the Yahoo news provider-helper (新聞來源列表) handler when ctx.req.param('region') is not 'hk' or 'tw'. The provider-list endpoint is only meaningful for HK/TW Yahoo, whose archive is organized by news provider keys.","triggerScenarios":"A request to the provider-helper route with region other than hk/tw. The guard fires before getProviderList(region) is invoked.","commonSituations":"Caller pointed a non-HK/TW region at this helper route expecting a provider list; integrator reused a region token from the general news route.","solutions":["Use 'hk' or 'tw' as the region segment.","For other regions there is no provider list — use the region's native RSS categories via /yahoo/news/:region/:category."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function requireHkTwRegion(region: string) {\n    if (!['hk', 'tw'].includes(region)) {\n        throw new InvalidParameterError(`Unknown region: ${region}. The provider list supports only hk and tw.`);\n    }\n}","typeGuard":"function isHkTwRegion(value: string): value is 'hk' | 'tw' {\n    return value === 'hk' || value === 'tw';\n}","tryCatchPattern":null,"preventionTips":["Reserve provider-based routes for hk/tw only.","Share the region guard across provider-helper, provider, and listid routes."],"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"}