DIYgod/RSSHub · error · Error

Invalid category

Error message

Invalid category

What it means

Thrown as a plain Error when the `category` path parameter on the Skeb main route does not match any key in the local `categoryMap` object (10 keys: new_art_works, new_voice_works, new_novel_works, new_video_works, new_music_works, new_correction_works, new_comic_works, popular_works, popular_creators, new_creators). The check uses Object.hasOwn against the whitelist. It is a user-facing validation guard that prevents downstream lookups into the API payload from failing on an unknown key.

Source

Thrown at lib/routes/skeb/index.ts:100

        },
        {
            title: '人気クリエイター',
            source: ['skeb.jp'],
            target: '/popular_creators',
        },
        {
            title: '新着クリエイター',
            source: ['skeb.jp'],
            target: '/new_creators',
        },
    ],
};

async function handler(ctx): Promise<Data> {
    const category = ctx.req.param('category') || 'new_art_works';

    if (!Object.hasOwn(categoryMap, category)) {
        throw new Error('Invalid category');
    }

    const url = `${baseUrl}/api`;

    const apiData = await cache.tryGet(
        url,
        async () => {
            const data = await ofetch(url);
            return data;
        },
        config.cache.routeExpire,
        false
    );

    if (!apiData || typeof apiData !== 'object') {
        throw new Error('Invalid data received from API');
    }

View on GitHub (pinned to bed535e087)

Solutions

  1. Use one of the ten valid category slugs from categoryMap: new_art_works, new_voice_works, new_novel_works, new_video_works, new_music_works, new_correction_works, new_comic_works, popular_works, popular_creators, new_creators.
  2. If you arrived via a broken link, check the Skeb homepage section titles and match the div id against the radar targets in the route definition.
  3. If you are a maintainer adding a new category, add the slug to categoryMap and the corresponding workCategories Set if it is a work-type category.

Example fix

// before
GET /skeb/art

// after
GET /skeb/new_art_works
Defensive patterns

Strategy: validation

Validate before calling

const VALID_CATEGORIES = ['new_art_works', 'new_voice_works', 'new_novel_works', 'new_video_works', 'new_music_works', 'new_correction_works', 'new_comic_works', 'popular_works', 'popular_creators', 'new_creators'];
const category = ctx.req.param('category') || 'new_art_works';
if (!VALID_CATEGORIES.includes(category)) {
    // return 400 or redirect to default instead of throwing
}

Type guard

function isValidSkebCategory(cat: string): cat is keyof typeof categoryMap {
    return Object.hasOwn(categoryMap, cat);
}

Prevention

When it happens

Trigger: A GET request to /skeb/<category> where <category> is anything other than the ten whitelisted keys (e.g. /skeb/foo, /skeb/art, /skeb/popular). The default fallback 'new_art_works' only applies when the param is absent, not when it is a bad value.

Common situations: User guesses or abbreviates a category name (e.g. 'art' instead of 'new_art_works'), copies a stale URL from documentation, or a radar rule / third-party integration sends an outdated category slug.

Related errors


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