DIYgod/RSSHub · warning · InvalidParameterError
Invalid id
Error message
Invalid id
What it means
Thrown as InvalidParameterError by the Mirror.xyz user route when the :id path parameter neither ends with '.eth' nor passes utils.isValidHost(id). The route accepts either an ENS name (foo.eth) or a plain hostname (used as a custom subdomain foo.mirror.xyz). Anything else — URL-encoded slashes, path-like segments, TLDs isValidHost rejects — is rejected before any fetch.
Source
Thrown at lib/routes/mirror/index.ts:35
example: '/mirror/tingfei.eth',
parameters: { id: 'user id' },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: 'User',
maintainers: ['fifteen42', 'rde9', 'nczitzk'],
handler,
};
async function handler(ctx) {
const id = ctx.req.param('id');
if (!id.endsWith('.eth') && !isValidHost(id)) {
throw new InvalidParameterError('Invalid id');
}
const rootUrl = 'https://mirror.xyz';
const currentUrl = id.endsWith('.eth') ? `${rootUrl}/${id}` : `https://${id}.mirror.xyz`;
const response = await got(currentUrl);
const data = JSON.parse(response.data.match(/"__NEXT_DATA__" type="application\/json">(\{"props":.*\})<\/script>/)[1]);
const items = Object.keys(data.props.pageProps.__APOLLO_STATE__)
.filter((key) => key.startsWith('entry:'))
.map((key) => {
const item = data.props.pageProps.__APOLLO_STATE__[key];
return {
title: item.title,
description: md.render(item.body),
link: `${currentUrl}/${item._id}`,
pubDate: parseDate(item.publishedAtTimestamp, 'X'),
author: data.props.pageProps.publicationLayoutProject.displayName,View on GitHub (pinned to bed535e087)
Solutions
- Use a bare ENS name ending in .eth, e.g. /mirror/tingfei.eth.
- If using a custom subdomain, pass only the host label (e.g. 'myblog') that would form myblog.mirror.xyz and ensure it is a syntactically valid hostname (letters/digits/hyphens, no underscores).
- Strip any leading 'https://' or trailing slash before the id reaches the route (fix the client/feed-URL construction).
- If the publication genuinely uses an underscore subdomain, that is currently unsupported — file an issue or use the .eth form.
Defensive patterns
Strategy: validation
Validate before calling
import { isValidHost } from '@/utils/valid-host';
const id = ctx.req.param('id');
const isEns = id.endsWith('.eth');
const isHost = isValidHost(id);
if (!isEns && !isHost) {
throw new InvalidParameterError(`Invalid id '${id}'. Use an ENS name ending in .eth or a valid hostname label.`);
} Type guard
function isMirrorId(id: string): boolean {
return typeof id === 'string' && (id.endsWith('.eth') || /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(id));
} Prevention
- Construct feed URLs from the publication's canonical id only, never a full URL.
- Document the two accepted forms (ENS vs hostname label) clearly in the route description.
- Reject path-like inputs (containing '/') early in any client that builds the feed URL.
When it happens
Trigger: Caller requests /mirror/<id> where id is, e.g., 'foo/bar', contains characters isValidHost disallows (underscores, leading hyphen, non-ASCII without punycode), or is a full URL like 'https://foo.eth'. The check `!id.endsWith('.eth') && !isValidHost(id)` is true, so it throws.
Common situations: User pastes a full mirror.xyz URL into the path; user passes a publication subdomain that contains an underscore (commonly invalid for hostnames); user encodes the id with %2F; the id is empty.
Related errors
- Invalid category
- At least one valid search parameter is required
- 无法检测 Discuz 版本,请在路由中指定版本参数,如 /discuz/x/ 或 /discuz/7/
- 通知类型${typeParam}未定义
- Unsupported language: ${language}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/3eb11a745c624c20.
Report an issue: GitHub.