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

  1. Use a bare ENS name ending in .eth, e.g. /mirror/tingfei.eth.
  2. 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).
  3. Strip any leading 'https://' or trailing slash before the id reaches the route (fix the client/feed-URL construction).
  4. 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

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


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/3eb11a745c624c20. Report an issue: GitHub.