DIYgod/RSSHub · error · ConfigNotFoundError

Baidu Tieba RSS is disabled due to the lack of <a href="http

Error message

Baidu Tieba RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/config#baidu">BAIDU_COOKIE</a>

What it means

ConfigNotFoundError thrown by getTiebaPageContent when config.baidu.cookie is falsy. The Playwright-based Tieba fetcher cannot operate without BAIDU_COOKIE because every page load needs authenticated cookies to pass Baidu's security verification, so the route refuses to run and points the operator at the deploy docs.

Source

Thrown at lib/routes/baidu/tieba/common.ts:54

/**
 * 使用 Playwright 获取贴吧页面内容
 * 包含统一的 cookie 设置、安全验证检查和缓存逻辑
 * 带有重试机制处理瞬态错误
 */
export async function getTiebaPageContent(
    url: string,
    cacheKey: string,
    options: {
        waitForSelector?: string;
        timeout?: number;
        retries?: number;
    } = {}
): Promise<string> {
    const cookie = config.baidu.cookie;

    if (!cookie) {
        throw new ConfigNotFoundError('Baidu Tieba RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/config#baidu">BAIDU_COOKIE</a>');
    }

    const cookies = parseBaiduCookies(cookie);
    const { waitForSelector = '.thread-card-wrapper, .virtual-list-item, .thread-content-box, .thread-card', timeout = 3000, retries = 3 } = options;

    const data = await cache.tryGet(
        cacheKey,
        async () => {
            let lastError: Error | undefined;

            /* eslint-disable no-await-in-loop -- Intentional sequential retry logic */
            for (let attempt = 0; attempt < retries; attempt++) {
                const { page, destroy } = await getPlaywrightPage(url, {
                    onBeforeLoad: async (page) => {
                        if (cookies.length > 0) {
                            await page.context().addCookies(cookies);
                        }
                    },

View on GitHub (pinned to bed535e087)

Solutions

  1. Set BAIDU_COOKIE in your RSSHub config (see https://docs.rsshub.app/deploy/config#baidu) to a cookie string copied from a logged-in tieba.baidu.com session, including BDUSS.
  2. Restart RSSHub after setting the env var so config is re-read.
  3. Verify with a smoke-test request to the Tieba route once the cookie is in place.
Defensive patterns

Strategy: validation

Validate before calling

if (!config.baidu.cookie) {
    throw new ConfigNotFoundError('BAIDU_COOKIE is not set. Configure it per https://docs.rsshub.app/deploy/config#baidu');
}

Type guard

function hasBaiduCookie(c: typeof config): boolean {
    return Boolean(c.baidu?.cookie);
}

Prevention

When it happens

Trigger: Any Tieba route that calls getTiebaPageContent while BAIDU_COOKIE is unset/empty in the RSSHub config.

Common situations: Self-hosted RSSHub deployed without BAIDU_COOKIE; env var name typo; cookie value cleared during a config rotation.

Related errors


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