DIYgod/RSSHub · error · InvalidParameterError
Invalid region
Error message
Invalid region
What it means
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.
Source
Thrown at lib/routes/liveuamap/index.ts:36
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['liveuamap.com/:region*'],
target: '/:region',
},
],
name: '实时消息',
maintainers: ['CoderSherlock'],
handler,
};
async function handler(ctx) {
const region = ctx.req.param('region') ?? 'ukraine';
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 50;
if (!isValidHost(region)) {
throw new InvalidParameterError('Invalid region');
}
const url = `https://${region}.liveuamap.com/`;
const response = await got({
method: 'get',
url,
});
const $ = load(response.data);
const items = $('div#feedler > div')
.slice(0, limit)
.toArray()
.map((item) => {
const $item = $(item);
return {
title: $item.find('div.title').text(),
description: $item.find('div.title').text(),View on GitHub (pinned to bed535e087)
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.
Example fix
// before: GET /liveuamap/ukraine/russia // after: GET /liveuamap/ukraine
Defensive patterns
Strategy: validation
Validate before calling
import { isValidHost } from '@/utils/valid-host';
function resolveLiveuamapRegion(region: string | undefined): string {
const r = (region ?? 'ukraine').trim();
if (!isValidHost(r)) {
throw new TypeError(`Invalid LiveUAMap region: '${region}'`);
}
return r;
} Type guard
function isLiveuamapRegion(value: string): boolean {
return /^[a-z0-9-]+$/i.test(value) && !value.includes('..');
} Try / catch
import { InvalidParameterError } from '@/errors/types/invalid-parameter';
try {
await fetch(`/liveuamap/${region}`);
} catch (e) {
if (e instanceof InvalidParameterError && /Invalid region/.test(e.message)) {
return { error: `Region '${region}' is not a valid LiveUAMap subdomain` };
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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`).
Common situations: 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.
Related errors
- Invalid name
- Invalid category: ${category}
- Invalid Locals content route option. Supported filters are `
- Category not found
- 无效的排序类型
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/6b62e3de89136f7a.
Report an issue: GitHub.