{"record":{"id":"6b62e3de89136f7a","repo":"DIYgod/RSSHub","slug":"invalid-region","errorCode":null,"errorMessage":"Invalid region","messagePattern":"Invalid region","errorType":"exception","errorClass":"InvalidParameterError","httpStatus":null,"severity":"error","filePath":"lib/routes/liveuamap/index.ts","lineNumber":36,"sourceCode":"        supportPodcast: false,\n        supportScihub: false,\n    },\n    radar: [\n        {\n            source: ['liveuamap.com/:region*'],\n            target: '/:region',\n        },\n    ],\n    name: '实时消息',\n    maintainers: ['CoderSherlock'],\n    handler,\n};\n\nasync function handler(ctx) {\n    const region = ctx.req.param('region') ?? 'ukraine';\n    const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 50;\n    if (!isValidHost(region)) {\n        throw new InvalidParameterError('Invalid region');\n    }\n\n    const url = `https://${region}.liveuamap.com/`;\n\n    const response = await got({\n        method: 'get',\n        url,\n    });\n    const $ = load(response.data);\n\n    const items = $('div#feedler > div')\n        .slice(0, limit)\n        .toArray()\n        .map((item) => {\n            const $item = $(item);\n            return {\n                title: $item.find('div.title').text(),\n                description: $item.find('div.title').text(),","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/liveuamap/index.ts#L18-L54","documentation":"Thrown by the LiveUAMap route when the `:region` path parameter fails the `isValidHost()` check (lib/routes/liveuamap/index.ts:36). The region is interpolated directly into a subdomain URL (`https://${region}.liveuamap.com/`), so it must be a syntactically valid DNS label. `InvalidParameterError` signals a user-supplied parameter problem rather than a server or config fault.","triggerScenarios":"Requesting `/liveuamap/<region>` with a value containing dots, slashes, spaces, underscores, or other characters disallowed in a hostname label; passing an empty string after explicit override; using a region code the host validation rejects (e.g. `russia.ukraine`, `ukraine/`, `en-uk`).","commonSituations":"Typos in region names; attempts to pass full URLs or paths as the region; locale prefixes copied from other sites; region values that were valid on a different LiveUAMap mirror.","solutions":["Use a simple alphanumeric region slug such as `ukraine` (default) or another supported LiveUAMap subdomain label.","Strip any protocol, path, or punctuation from the region before requesting the route.","Confirm the subdomain resolves by checking `https://<region>.liveuamap.com/` in a browser."],"exampleFix":"// before: GET /liveuamap/ukraine/russia\n// after:  GET /liveuamap/ukraine","handlingStrategy":"validation","validationCode":"import { isValidHost } from '@/utils/valid-host';\nfunction resolveLiveuamapRegion(region: string | undefined): string {\n    const r = (region ?? 'ukraine').trim();\n    if (!isValidHost(r)) {\n        throw new TypeError(`Invalid LiveUAMap region: '${region}'`);\n    }\n    return r;\n}","typeGuard":"function isLiveuamapRegion(value: string): boolean {\n    return /^[a-z0-9-]+$/i.test(value) && !value.includes('..');\n}","tryCatchPattern":"import { InvalidParameterError } from '@/errors/types/invalid-parameter';\ntry {\n    await fetch(`/liveuamap/${region}`);\n} catch (e) {\n    if (e instanceof InvalidParameterError && /Invalid region/.test(e.message)) {\n        return { error: `Region '${region}' is not a valid LiveUAMap subdomain` };\n    }\n    throw e;\n}","preventionTips":["Treat region as a DNS label: letters, digits, hyphens only.","Default to 'ukraine' when the param is empty rather than letting garbage through.","Reject values containing '.', '/', or protocol substrings up front."],"tags":["invalid-input","route-parameter","dns-validation"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}