{"record":{"id":"2d4ae6504da7e355","repo":"DIYgod/RSSHub","slug":"invalid-lang","errorCode":null,"errorMessage":"Invalid lang","messagePattern":"Invalid lang","errorType":"exception","errorClass":null,"httpStatus":503,"severity":"warning","filePath":"lib/routes-deprecated/engadget/home.js","lineNumber":9,"sourceCode":"const got = require('@/utils/got');\nconst cheerio = require('cheerio');\nconst parser = require('@/utils/rss-parser');\nconst allowLang = new Set(['chinese', 'cn', 'us', 'japanese', 'www']);\n\nmodule.exports = async (ctx) => {\n    const lang = ctx.params.lang === 'us' ? 'www' : ctx.params.lang || 'cn';\n    if (!allowLang.has(lang)) {\n        throw new Error('Invalid lang');\n    }\n    const rssUrl = `https://${lang}.engadget.com/rss.xml`;\n    const feed = await parser.parseURL(rssUrl);\n\n    const ProcessFeed = (data) => {\n        const $ = cheerio.load(data);\n        if (ctx.params.lang === 'us') {\n            $('div#engadget-article-footer').remove();\n            $('div#right-ads-rail').remove();\n            $('.t-meta.c-gray-3.mb-35').remove();\n            return $('div#page_body').html();\n        } else {\n            $('span#end-legacy-contents').remove();\n            $('#post-slideshow figcaption').remove();\n            $('#post-slideshow div.pagination button').remove();\n            $('#post-slideshow img.scrollview-image-embedded').each((i, el) => {\n                $(el).attr('src', $(el).data('wf-src'));\n            });","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes-deprecated/engadget/home.js#L1-L27","documentation":"Thrown by the engadget home route when the resolved `lang` is not in the allowLang set {chinese, cn, us, japanese, www}. Note 'us' is internally remapped to 'www', but any other value (e.g. 'uk', 'de', 'fr') is rejected.","triggerScenarios":"Request to /engadget/:lang with a lang not in the allowLang set.","commonSituations":"User requests a regional variant Engadget does not actually publish via RSS; typo; passing 'usa' instead of 'us'.","solutions":["Use one of: chinese, cn, us, japanese (or omit for the cn default).","Do not request unsupported locales; Engadget only publishes those variants."],"exampleFix":"// before\n/engadget/usa\n// after\n/engadget/us","handlingStrategy":"type-guard","validationCode":"const allowLang = new Set(['chinese','cn','us','japanese','www']);\nif (!allowLang.has(lang)) throw new Error('Invalid lang');","typeGuard":"const isAllowedLang = (l: unknown): boolean =>\n  typeof l === 'string' && allowLang.has(l);","tryCatchPattern":null,"preventionTips":["Surface the allow-list in the route's error message.","Treat 'us'->'www' normalization as the only accepted alias."],"tags":["validation","routes","config"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}