{"record":{"id":"323e8fe7ffbfdd56","repo":"DIYgod/RSSHub","slug":"unsupported-language-language","errorCode":null,"errorMessage":"Unsupported language: ${language}","messagePattern":"Unsupported language: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/geocaching/blogs.ts","lineNumber":68,"sourceCode":"        per_page: number;\n        _embed: number;\n        _fields: string;\n        categories_exclude?: string;\n        categories?: number;\n    } = {\n        per_page: ctx.req.query('limit') ?? 20,\n        _embed: 1,\n        _fields: ['id', 'title', 'link', 'guid', 'content', 'date_gmt', 'modified_gmt', '_embedded', '_links'].join(','),\n    };\n\n    if (language === 'en') {\n        searchParams.categories_exclude = Object.values(languageToCategory).join(',');\n    } else if (Object.hasOwn(languageToCategory, language)) {\n        searchParams.categories = languageToCategory[language];\n    } else if (language === 'all') {\n        // do nothing\n    } else {\n        throw new Error(`Unsupported language: ${language}`);\n    }\n\n    // console.log(searchParams);\n\n    const { data: response } = await got(`${baseUrl}/blog/wp-json/wp/v2/posts`, { searchParams });\n    const items = response.map((item) => {\n        const media = item._embedded['wp:featuredmedia'][0];\n        const mediaDetails = media?.media_details;\n        const mediaSize = mediaDetails?.sizes.large || mediaDetails?.sizes.full;\n        return {\n            title: item.title.rendered.trim(),\n            link: item.link,\n            guid: item.guid.rendered,\n            description: item.content.rendered,\n            pubDate: parseDate(item.date_gmt),\n            updated: parseDate(item.modified_gmt),\n            author: item._embedded.author[0].name,\n            category: item._embedded['wp:term'][0].map((category) => category.name.trim()),","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/geocaching/blogs.ts#L50-L86","documentation":"Thrown by the Geocaching blogs route when the ':language' path parameter is not one of the supported values. The route checks three branches: 'en' (English, excludes other categories), any key in languageToCategory (de, fr, es, nl, cs), and 'all' (no filtering). Any other value hits the else branch and throws.","triggerScenarios":"A request to /geocaching/blogs/<language> where <language> is not 'en', 'de', 'fr', 'es', 'nl', 'cs', or 'all'. The route parameters declaration also lists these as options, so the RSSHub API UI typically constrains input, but direct URL access bypasses that.","commonSituations":"Using a language code that isn't supported (e.g., 'it' for Italian, 'pt' for Portuguese); uppercase variants ('EN', 'DE'); typos; using 'english' instead of 'en'.","solutions":["Use one of the seven valid language codes: en, de, fr, es, nl, cs, all","Omit the language parameter to default to 'en'","Check the route parameters declaration in the source for the authoritative options list"],"exampleFix":"// before\n} else {\n    throw new Error(`Unsupported language: ${language}`);\n}\n\n// after (use InvalidParameterError and list valid values)\nimport InvalidParameterError from '@/errors/types/invalid-parameter';\n// ...\n} else {\n    throw new InvalidParameterError(`Unsupported language '${language}'. Supported: en, de, fr, es, nl, cs, all`);\n}","handlingStrategy":"validation","validationCode":"const VALID_LANGUAGES = ['en', 'de', 'fr', 'es', 'nl', 'cs', 'all'];\nconst language = ctx.req.param('language') ?? 'en';\nif (!VALID_LANGUAGES.includes(language)) {\n    throw new InvalidParameterError(`Unsupported language '${language}'. Supported: ${VALID_LANGUAGES.join(', ')}`);\n}","typeGuard":"function isSupportedLanguage(lang: string): lang is 'en' | 'de' | 'fr' | 'es' | 'nl' | 'cs' | 'all' {\n    return lang === 'en' || lang === 'all' || Object.hasOwn(languageToCategory, lang);\n}","tryCatchPattern":null,"preventionTips":["Use the route parameters options declaration to constrain input in the UI","Default to 'en' when the parameter is omitted","Normalize input to lowercase before validation"],"tags":["validation","parameter","invalid-parameter"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}