DIYgod/RSSHub · error · Error

Status code ${renderData.status_code}

Error message

Status code ${renderData.status_code}

What it means

Thrown by the Douyin live room route when the intercepted room info API response (`/webcast/room/web/enter`) has a non-zero `status_code`. A status_code of 0 means success; any other value indicates Douyin's API rejected the request (e.g. room doesn't exist, room has been deleted, or the request was flagged as automated). The specific status code is included in the error message.

Source

Thrown at lib/routes/douyin/live.ts:70

                const request = response.request();
                if (request.url().includes('/webcast/room/web/enter')) {
                    roomInfo = await response.json();
                }
            });
            logger.http(`Requesting ${pageUrl}`);
            await page.goto(pageUrl, {
                waitUntil: 'networkidle',
            });
            await context.close();

            return roomInfo;
        },
        config.cache.routeExpire,
        false
    );

    if (renderData.status_code !== 0) {
        throw new Error(`Status code ${renderData.status_code}`);
    }

    const roomInfo = renderData.data.data[0];
    const roomOwner = renderData.data.user;
    const nickname = roomOwner.nickname;
    const userAvatar = roomOwner.avatar_thumb.url_list[0];

    const items: DataItem[] = [];
    if (roomInfo.id_str) {
        if (roomInfo.status === 2) {
            items.push({
                title: `开播:${roomInfo.title}`,
                description: `<img src="${roomInfo.cover.url_list[0]}">`,
                link: pageUrl,
                author: nickname,
                guid: roomInfo.id_str, // roomId is unique for each live event
            });
        } else if (roomInfo.status === 4) {

View on GitHub (pinned to bed535e087)

Solutions

  1. Verify the room ID by visiting https://live.douyin.com/<rid> in a browser.
  2. Retry — the route caches results, so a transient failure may resolve on cache expiry.
  3. If the status code persists, the room likely no longer exists or is permanently unavailable.
  4. Check Douyin API status code documentation if available (common non-zero codes indicate various error states).

Example fix

// before
if (renderData.status_code !== 0) {
    throw new Error(`Status code ${renderData.status_code}`);
}

// after — include more context for debugging
if (renderData.status_code !== 0) {
    const statusMsg = renderData.status_msg || renderData.message || 'Unknown error';
    throw new Error(`Douyin live API error (status_code ${renderData.status_code}): ${statusMsg}`);
}
Defensive patterns

Strategy: try-catch

Type guard

interface DouyinLiveResponse {
    status_code: number;
    status_msg?: string;
    data?: {
        data: unknown[];
        user: { nickname: string };
    };
}

function isSuccessfulLiveResponse(data: unknown): data is DouyinLiveResponse {
    return typeof data === 'object' && data !== null && (data as any).status_code === 0;
}

Try / catch

try {
    const feed = await fetch(`${rsshubUrl}/douyin/live/${rid}`);
} catch (e) {
    if (e.message.includes('Status code')) {
        const code = e.message.match(/Status code (\d+)/)?.[1];
        console.error(`Douyin API returned status ${code}. Room may not exist or is restricted.`);
        // Retry once after cache expiry
    }
    throw e;
}

Prevention

When it happens

Trigger: The live room ID doesn't exist or has been deleted; Douyin's webcast API returned a rate-limit or permission error; Playwright failed to intercept the `/webcast/room/web/enter` response correctly, leaving roomInfo with an unexpected structure.

Common situations: User enters an outdated or incorrect room ID; the streamer's room was taken down; Douyin updated its API response format; the Playwright interception occasionally misses the response due to timing.

Related errors


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