DIYgod/RSSHub · warning · InvalidParameterError

Invalid user name

Error message

Invalid user name

What it means

Thrown as an `InvalidParameterError` when the `creator` path parameter fails `isValidHost()`. The regex `/^[\dA-Z](?:[\dA-Z-]{0,61}[\dA-Z])?$/i` ensures the creator handle is hostname-safe, because it is interpolated into both an API URL (`api.fanbox.cc/creator.get?creatorId=${creator}`) and the output feed link (`https://${creator}.fanbox.cc`). Characters like dots, underscores, or slashes are rejected.

Source

Thrown at lib/routes/fanbox/index.ts:37

    name: 'Creator',
    handler,
    features: {
        requireConfig: [
            {
                name: 'FANBOX_SESSION_ID',
                description: 'Required for private posts. Can be found in browser DevTools -> Application -> Cookies -> https://www.fanbox.cc -> FANBOXSESSID',
                optional: true,
            },
        ],
        requirePuppeteer: true,
        nsfw: true,
    },
};

async function handler(ctx: Context): Promise<Data> {
    const creator = ctx.req.param('creator');
    if (!isValidHost(creator)) {
        throw new InvalidParameterError('Invalid user name');
    }

    let title = `Fanbox - ${creator}`;

    let description: string | undefined;

    let image: string | undefined;

    try {
        const userApi = `https://api.fanbox.cc/creator.get?creatorId=${creator}`;
        const userInfoResponse = (await ofetch(userApi, {
            headers: getHeaders(),
        })) as UserInfoResponse;
        title = `Fanbox - ${userInfoResponse.body.user.name}`;
        description = userInfoResponse.body.description;
        image = userInfoResponse.body.user.iconUrl;
    } catch {
        // ignore

View on GitHub (pinned to bed535e087)

Solutions

  1. Pass only the creator handle as it appears in the Fanbox URL subdomain: e.g., `/fanbox/official` not `/fanbox/https://official.fanbox.cc`.
  2. Ensure the handle contains only alphanumeric characters and internal hyphens.
  3. If the creator handle legitimately contains unsupported characters, this route cannot serve it — check if Fanbox provides an alternative ID.
Defensive patterns

Strategy: validation

Validate before calling

import { isValidHost } from '@/utils/valid-host';

function validateCreator(creator: string | undefined): string {
    if (!creator || !isValidHost(creator)) {
        throw new InvalidParameterError('Creator must be a hostname-safe string (alphanumeric and hyphens)');
    }
    return creator;
}

Type guard

function isValidCreatorHandle(handle: string | undefined): boolean {
    if (typeof handle !== 'string') return false;
    return /^[\dA-Z](?:[\dA-Z-]{0,61}[\dA-Z])?$/i.test(handle);
}

Prevention

When it happens

Trigger: A user passes a creator name containing invalid characters — e.g., `user.name` (dot), `user_name` (underscore), `user/name` (slash), or an empty string. The isValidHost regex test fails before any Fanbox API call is made.

Common situations: User copies a full Fanbox URL instead of just the creator handle. User passes a Japanese character creator name that does not match the ASCII hostname regex. The creator handle contains a hyphen at the start or end (invalid per the regex).

Related errors


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