DIYgod/RSSHub · warning · InvalidParameterError

Unsupported key

Error message

Unsupported key

What it means

An InvalidParameterError from the nhentai filter route. The route defines a whitelist Set of seven keys (parody, character, tag, artist, group, language, category) and rejects any other value before building the nhentai.net URL. It is a user-input validation guard, not an upstream failure.

Source

Thrown at lib/routes/nhentai/index.ts:38

        supportBT: true,
        nsfw: true,
    },
    radar: [
        {
            source: ['nhentai.net/:key/:keyword'],
            target: '/index/:key/:keyword',
        },
    ],
    name: 'Filter',
    maintainers: ['MegrezZhu', 'hoilc', 'pseudoyu'],
    handler,
};

async function handler(ctx) {
    const { key, keyword, mode } = ctx.req.param();

    if (!supportedKeys.has(key)) {
        throw new InvalidParameterError('Unsupported key');
    }

    const url = `https://nhentai.net/${key}/${keyword.toLowerCase().replace(' ', '-')}/`;

    const simples = await getSimple(url);

    const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 5;
    let items = simples;
    if (mode === 'detail') {
        items = await getDetails(cache, simples, limit);
    } else if (mode === 'torrent') {
        items = await getTorrents(cache, simples, limit);
    }

    return {
        title: `nhentai - ${key} - ${keyword}`,
        link: url,
        description: 'hentai',

View on GitHub (pinned to bed535e087)

Solutions

  1. Use one of the documented keys: parody, character, tag, artist, group, language, or category.
  2. Make sure the key is lowercase — the whitelist Set is case-sensitive.
  3. Cross-check the value against the route's parameters docs in the route definition.

Example fix

// before
if (!supportedKeys.has(key)) {
    throw new InvalidParameterError('Unsupported key');
}

// after — caller fix: use a valid key
//   GET /nhentai/index/language/chinese   ✓
//   GET /nhentai/index/tag/xxx            ✓
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set(['parody','character','tag','artist','group','language','category']);
function buildNhentaiUrl(key, keyword) {
  if (!SUPPORTED.has(key)) throw new Error(`Unsupported key '${key}'. Valid: ${[...SUPPORTED].join(', ')}`);
  return `https://nhentai.net/${key}/${keyword.toLowerCase().replace(' ', '-')}/`;
}

Type guard

const isSupportedKey = (k: string): k is 'parody'|'character'|'tag'|'artist'|'group'|'language'|'category' =>
  SUPPORTED.has(k);

Prevention

When it happens

Trigger: Calling /nhentai/index/:key/:keyword with a key not in supportedKeys — e.g. /nhentai/index/genre/xxx, /nhentai/index/search/xxx, typos like /nhentai/index/Language/xxx (case-sensitive), or copied URLs where the path segment does not correspond to a nhentai filter namespace.

Common situations: User mistypes the filter key; user assumes a key (like 'search' or 'genre') exists when it does not; case mismatch (the Set is lowercase); copy-pasting a nhentai URL segment that is not a real filter path.

Related errors


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