{"record":{"id":"d95d75f33204dc26","repo":"DIYgod/RSSHub","slug":"invalid-category-d95d75","errorCode":null,"errorMessage":"Invalid category","messagePattern":"Invalid category","errorType":"exception","errorClass":"Error","httpStatus":503,"severity":"error","filePath":"lib/routes/skeb/index.ts","lineNumber":100,"sourceCode":"        },\n        {\n            title: '人気クリエイター',\n            source: ['skeb.jp'],\n            target: '/popular_creators',\n        },\n        {\n            title: '新着クリエイター',\n            source: ['skeb.jp'],\n            target: '/new_creators',\n        },\n    ],\n};\n\nasync function handler(ctx): Promise<Data> {\n    const category = ctx.req.param('category') || 'new_art_works';\n\n    if (!Object.hasOwn(categoryMap, category)) {\n        throw new Error('Invalid category');\n    }\n\n    const url = `${baseUrl}/api`;\n\n    const apiData = await cache.tryGet(\n        url,\n        async () => {\n            const data = await ofetch(url);\n            return data;\n        },\n        config.cache.routeExpire,\n        false\n    );\n\n    if (!apiData || typeof apiData !== 'object') {\n        throw new Error('Invalid data received from API');\n    }\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/skeb/index.ts#L82-L118","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","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.","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."],"exampleFix":"// before\nGET /skeb/art\n\n// after\nGET /skeb/new_art_works","handlingStrategy":"validation","validationCode":"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'];\nconst category = ctx.req.param('category') || 'new_art_works';\nif (!VALID_CATEGORIES.includes(category)) {\n    // return 400 or redirect to default instead of throwing\n}","typeGuard":"function isValidSkebCategory(cat: string): cat is keyof typeof categoryMap {\n    return Object.hasOwn(categoryMap, cat);\n}","tryCatchPattern":null,"preventionTips":["Document all valid category slugs in the route's parameters description so users can discover them.","Consider using Hono's built-in enum route parameter validation if available, or a middleware that validates path params against a whitelist.","Return the list of valid categories in the error message body so the user can self-correct."],"tags":["validation","user-input","skeb","routing"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}