{"record":{"id":"ca1149be96457ff4","repo":"DIYgod/RSSHub","slug":"unknown-order-order-ca1149","errorCode":null,"errorMessage":"Unknown order: ${order}","messagePattern":"Unknown order: (.+?)","errorType":"exception","errorClass":null,"httpStatus":503,"severity":"error","filePath":"lib/routes/bilibili/live-search.ts","lineNumber":40,"sourceCode":"    handler,\n};\n\nasync function handler(ctx) {\n    const key = ctx.req.param('key');\n    const order = ctx.req.param('order');\n\n    const urlEncodedKey = encodeURIComponent(key);\n    let orderTitle: string;\n\n    switch (order) {\n        case 'live_time':\n            orderTitle = '最新开播';\n            break;\n        case 'online':\n            orderTitle = '人气直播';\n            break;\n        default:\n            throw new Error(`Unknown order: ${order}`);\n    }\n    const wbiVerifyString = await cache.getWbiVerifyString();\n    let params = `__refresh__=true&_extra=&context=&page=1&page_size=42&order=${order}&duration=&from_source=&from_spmid=333.337&platform=pc&highlight=1&single_column=0&keyword=${urlEncodedKey}&ad_resource=&source_tag=3&gaia_vtoken=&category_id=&search_type=live&dynamic_offset=0&web_location=1430654`;\n    params = utils.addWbiVerifyInfo(params, wbiVerifyString);\n\n    const response = await got({\n        method: 'get',\n        url: `https://api.bilibili.com/x/web-interface/wbi/search/type?${params}`,\n        headers: {\n            Referer: `https://search.bilibili.com/live?keyword=${urlEncodedKey}&from_source=webtop_search&spm_id_from=444.7&search_source=3&search_type=live_room`,\n            Cookie: await cache.getCookie(),\n        },\n    });\n    const data = response.data.data.result.live_room;\n\n    return {\n        title: `哔哩哔哩直播-${key}-${orderTitle}`,\n        link: `https://search.bilibili.com/live?keyword=${urlEncodedKey}&order=${order}&coverType=user_cover&page=1&search_type=live`,","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bilibili/live-search.ts#L22-L58","documentation":"Generic Error thrown by the live-search route when the :order path parameter does not match 'live_time' or 'online'. Identical validation pattern to live-area but for the live search route. The switch default fires before the wbi-signed search API call is made.","triggerScenarios":"Requesting /bilibili/live/search/:key/:order with an order value other than 'live_time' or 'online'.","commonSituations":"Incorrect order value in the subscription URL; user assumed different sort options exist; typo.","solutions":["Use 'live_time' or 'online' as the order parameter.","Correct the subscription URL in your RSS reader."],"exampleFix":"// before\n// /bilibili/live/search/game/popular\n\n// after\n// /bilibili/live/search/game/online","handlingStrategy":"validation","validationCode":"const validOrders = ['live_time', 'online'] as const;\nif (!validOrders.includes(order as any)) {\n    throw new Error(`Invalid order '${order}'. Use 'live_time' or 'online'.`);\n}","typeGuard":"function isValidOrder(order: string): order is 'live_time' | 'online' {\n    return order === 'live_time' || order === 'online';\n}","tryCatchPattern":null,"preventionTips":["Share validation logic between live-area and live-search routes.","Document accepted order values prominently.","Validate early before expensive wbi signing."],"tags":["bilibili","validation","invalid-parameters","switch-default","rsshub"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}