{"record":{"id":"c1000bdceb867d3b","repo":"DIYgod/RSSHub","slug":"invalid-syosetu-subsite-nvalid-subsites-are-yomo","errorCode":null,"errorMessage":"Invalid Syosetu subsite.\\nValid subsites are: yomou, noc, mnlt, mid","messagePattern":"Invalid Syosetu subsite\\.\\\\nValid subsites are: yomou, noc, mnlt, mid","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/syosetu/search.ts","lineNumber":120,"sourceCode":"\n    const r18Params = { ...searchParams };\n\n    switch (sub) {\n        case SyosetuSub.NOCTURNE:\n            r18Params.nocgenre = R18Site.Nocturne;\n            break;\n        case SyosetuSub.MOONLIGHT:\n            // If either 女性向け/BL is chosen, nocgenre will be in query string\n            // If no specific genre selected, include both\n            if (!r18Params.nocgenre) {\n                r18Params.nocgenre = [R18Site.MoonLight, R18Site.MoonLightBL].join('-') as Join<R18Site>;\n            }\n            break;\n        case SyosetuSub.MIDNIGHT:\n            r18Params.nocgenre = R18Site.Midnight;\n            break;\n        default:\n            throw new InvalidParameterError('Invalid Syosetu subsite.\\nValid subsites are: yomou, noc, mnlt, mid');\n    }\n\n    return new SearchBuilderR18(r18Params, new NarouNovelFetch());\n}\n\nasync function handler(ctx: Context): Promise<Data> {\n    const { sub, query } = ctx.req.param();\n    const searchUrl = `https://${sub}.syosetu.com/search/search/search.php?${query}`;\n\n    const limit = Math.min(Number(ctx.req.query('limit') ?? 40), 40);\n    const searchParams = mapToSearchParams(query, limit);\n    const builder = createNovelSearchBuilder(sub, searchParams);\n    const result = await builder.execute();\n\n    const items = result.values.map((novel) => ({\n        title: novel.title,\n        link: `https://${isGeneral(sub) ? 'ncode' : 'novel18'}.syosetu.com/${String(novel.ncode).toLowerCase()}`,\n        description: renderDescription({ novel, genreText: GenreNotation[novel.genre] }),","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/syosetu/search.ts#L102-L138","documentation":"Thrown by syosetu/search.ts:120 as an InvalidParameterError in the default arm of createNovelSearchBuilder, when `sub` is not 'yomou' (handled earlier, returns a general SearchBuilder) and not one of the R18 cases {noc, mnlt, mid}. CRITICAL footgun: the SyosetuSub enum in types/search.ts has only FOUR members (YOMOU, NOCTURNE, MOONLIGHT, MIDNIGHT) and does NOT include MOONLIGHT_BL — so /syosetu/search/mnlt-bl/... throws here, even though mnlt-bl is a valid subsite in the rankingr18 route. The same-named enum diverges between files.","triggerScenarios":"/syosetu/search/<sub>/<query> with sub not in {yomou, noc, mnlt, mid}: specifically mnlt-bl throws; full names like 'nocturne' or 'moonlight'; typos.","commonSituations":"Trying to search Moonlight BL via this route (not supported — you must use mnlt and pass nocgenre in the query string); assuming mnlt-bl works here because it works in rankingr18; using the display name.","solutions":["Use yomou, noc, mnlt, or mid as the sub.","For Moonlight BL results, use sub=mnlt and supply the nocgenre parameter in the query string."],"exampleFix":"// before (mnlt-bl is not a valid search subsite)\nGET /syosetu/search/mnlt-bl/word=...\n// after (use mnlt + nocgenre in query)\nGET /syosetu/search/mnlt/word=...&nocgenre=<MoonLightBL>","handlingStrategy":"validation","validationCode":"import { SyosetuSub } from './types/search';\n\n// search.ts SyosetuSub is {yomou, noc, mnlt, mid} — mnlt-bl is NOT valid here.\nfunction isValidSearchSub(sub: string): boolean {\n  return Object.values(SyosetuSub).includes(sub as SyosetuSub);\n}","typeGuard":"import { SyosetuSub } from './types/search';\n\nfunction isSearchSub(sub: string): sub is SyosetuSub {\n  return ['yomou', 'noc', 'mnlt', 'mid'].includes(sub);\n}","tryCatchPattern":null,"preventionTips":["Use yomou, noc, mnlt, or mid for the search route — never mnlt-bl.","For Moonlight BL, use sub=mnlt and pass nocgenre in the query string.","Remember the SyosetuSub enum diverges between search.ts and ranking-r18.ts."],"tags":["invalid-parameter","enum","syosetu","subsite","footgun"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}