{"record":{"id":"9cb4b1273305f781","repo":"DIYgod/RSSHub","slug":"unknown-order-order","errorCode":null,"errorMessage":"Unknown order: ${order}","messagePattern":"Unknown order: (.+?)","errorType":"exception","errorClass":null,"httpStatus":503,"severity":"error","filePath":"lib/routes/bilibili/live-area.ts","lineNumber":38,"sourceCode":"    description: `::: warning\n由于接口未提供开播时间，如果直播间未更换标题与分区，将视为一次。如果直播间更换分区与标题，将视为另一项\n:::`,\n};\n\nasync function handler(ctx) {\n    const areaID = ctx.req.param('areaID');\n    const order = ctx.req.param('order');\n\n    let orderTitle: string;\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\n    const nameResponse = await got({\n        method: 'get',\n        url: 'https://api.live.bilibili.com/room/v1/Area/getList',\n        headers: {\n            Referer: 'https://link.bilibili.com/p/center/index',\n        },\n    });\n\n    let parentTitle = '';\n    let areaTitle = '';\n    let areaLink = '';\n\n    for (const parentArea of nameResponse.data.data) {\n        for (const area of parentArea.list) {\n            if (area.id !== areaID) {\n                continue;","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bilibili/live-area.ts#L20-L56","documentation":"Generic Error thrown by the live-area route when the :order path parameter does not match 'live_time' or 'online'. The switch statement's default case fires, meaning the sort order is unrecognized. The route queries Bilibili's live area listing and needs a valid order to construct the correct API request.","triggerScenarios":"Requesting /bilibili/live/area/:areaID/:order with an order value other than 'live_time' (最新开播) or 'online' (人气直播).","commonSituations":"User guessed the order parameter; typo in the URL; subscriber used 'newest' or 'popular' instead of the internal values.","solutions":["Use 'live_time' for newest streams or 'online' for most popular streams.","Update the subscription URL in your RSS reader with a valid order value."],"exampleFix":"// before\n// /bilibili/live/area/0/newest\n\n// after\n// /bilibili/live/area/0/live_time","handlingStrategy":"validation","validationCode":"const validOrders = ['live_time', 'online'] as const;\nif (!validOrders.includes(order as any)) {\n    throw new Error(`Invalid order '${order}'. Valid: ${validOrders.join(', ')}`);\n}","typeGuard":"function isValidOrder(order: string): order is 'live_time' | 'online' {\n    return order === 'live_time' || order === 'online';\n}","tryCatchPattern":null,"preventionTips":["Use TypeScript literal union types for path params.","Document valid order values in route metadata.","Test routes with all valid parameter combinations."],"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"}