DIYgod/RSSHub · error

Unknown order: ${order}

Error message

Unknown order: ${order}

What it means

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.

Source

Thrown at lib/routes/bilibili/live-area.ts:38

    description: `::: warning
由于接口未提供开播时间,如果直播间未更换标题与分区,将视为一次。如果直播间更换分区与标题,将视为另一项
:::`,
};

async function handler(ctx) {
    const areaID = ctx.req.param('areaID');
    const order = ctx.req.param('order');

    let orderTitle: string;
    switch (order) {
        case 'live_time':
            orderTitle = '最新开播';
            break;
        case 'online':
            orderTitle = '人气直播';
            break;
        default:
            throw new Error(`Unknown order: ${order}`);
    }

    const nameResponse = await got({
        method: 'get',
        url: 'https://api.live.bilibili.com/room/v1/Area/getList',
        headers: {
            Referer: 'https://link.bilibili.com/p/center/index',
        },
    });

    let parentTitle = '';
    let areaTitle = '';
    let areaLink = '';

    for (const parentArea of nameResponse.data.data) {
        for (const area of parentArea.list) {
            if (area.id !== areaID) {
                continue;

View on GitHub (pinned to bed535e087)

Solutions

  1. Use 'live_time' for newest streams or 'online' for most popular streams.
  2. Update the subscription URL in your RSS reader with a valid order value.

Example fix

// before
// /bilibili/live/area/0/newest

// after
// /bilibili/live/area/0/live_time
Defensive patterns

Strategy: validation

Validate before calling

const validOrders = ['live_time', 'online'] as const;
if (!validOrders.includes(order as any)) {
    throw new Error(`Invalid order '${order}'. Valid: ${validOrders.join(', ')}`);
}

Type guard

function isValidOrder(order: string): order is 'live_time' | 'online' {
    return order === 'live_time' || order === 'online';
}

Prevention

When it happens

Trigger: Requesting /bilibili/live/area/:areaID/:order with an order value other than 'live_time' (最新开播) or 'online' (人气直播).

Common situations: User guessed the order parameter; typo in the URL; subscriber used 'newest' or 'popular' instead of the internal values.

Related errors


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