DIYgod/RSSHub · warning · InvalidParameterError

ユーザー名は@で始まる必要があります

Error message

ユーザー名は@で始まる必要があります

What it means

Thrown as InvalidParameterError by the mixi2 (mixi social) user route when the :name path parameter does not start with '@'. The route expects the leading-@ handle form (e.g. @deyo) because the underlying MixiClient.getPersonaByName takes the name without the @, which the handler strips via name.slice(1). A name without '@' would corrupt that strip, so it is rejected up front.

Source

Thrown at lib/routes/mixi2/user.ts:16

import type { Context } from 'hono';

import InvalidParameterError from '@/errors/types/invalid-parameter';
import type { Data, Route } from '@/types';
import { ViewType } from '@/types';
import { parseDate } from '@/utils/parse-date';

import { CONFIG_OPTIONS, getClient, parsePost, postFilter } from './utils';

const handler = async (ctx: Context) => {
    const limit = Number(ctx.req.query('limit') ?? '20');
    const name = ctx.req.param('name');
    const mediaOnly = ctx.req.param('media') === 'media';

    if (!name!.startsWith('@')) {
        throw new InvalidParameterError('ユーザー名は@で始まる必要があります');
    }

    const client = getClient();

    const userInfo = await client.getPersonaByName({
        name: name!.slice(1),
    });

    const persona = userInfo.persona;

    const data = await client.getPersonalTimeline({
        personaId: persona?.personaId,
        limit,
        mediaOnly,
    });

    return {
        title: `${persona?.name} - ${mediaOnly ? 'メディア' : 'ポスト'}`,

View on GitHub (pinned to bed535e087)

Solutions

  1. Prefix the username with '@', e.g. /mixi2/user/@deyo (optionally followed by /media for media-only).
  2. Strip any leading URL scheme/path before the @ in any feed-URL generator.
  3. If maintaining the route, consider auto-prepending '@' when missing instead of throwing.
Defensive patterns

Strategy: validation

Validate before calling

const name = ctx.req.param('name');
if (!name || !name.startsWith('@')) {
    throw new InvalidParameterError(`Username must start with '@', e.g. @deyo; got: ${name}`);
}

Type guard

function isAtHandle(name: string): boolean {
    return typeof name === 'string' && name.startsWith('@') && name.length > 1;
}

Prevention

When it happens

Trigger: Caller requests /mixi2/user/<name> where name is e.g. 'deyo' (no @), an empty string, or a URL. The startsWith('@') check fails and it throws before constructing the client.

Common situations: User pastes the bare handle copied from a URL path; URL builder drops the @; user passes the full https://mixi.social/@name URL.

Related errors


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