DIYgod/RSSHub · warning · Error

Cooling down before new visitor Cookies from ${url} may be f

Error message

Cooling down before new visitor Cookies from ${url} may be fetched

What it means

A self-imposed cooldown guard inside getCookies(). After a visitor-cookie fetch attempt, coolingDown stays true for config.cache.routeExpire seconds; any further request that is NOT carrying a RenewWeiboCookiesError (i.e. renew is false or a plain boolean true with no .message) is rejected to avoid hammering m.weibo.cn with headless browser launches.

Source

Thrown at lib/routes/weibo/utils.ts:73

                    throw new Error('Cookies expired. Please update WEIBO_COOKIES');
                }
                return config.weibo.cookies;
            }

            const cacheKey = 'weibo:visitor-cookies';
            if (renew) {
                cache.set(cacheKey, '', 1);
            }
            return await cache.tryGet(cacheKey, async () => {
                if (visitorCookiesPromise) {
                    return await visitorCookiesPromise;
                }
                if (coolingDown) {
                    if (renew?.message) {
                        logger.warn(coolingDownMessage);
                        throw renew;
                    }
                    throw new Error(coolingDownMessage);
                }
                coolingDown = true;
                setTimeout(() => {
                    coolingDown = false;
                }, config.cache.routeExpire * 1000);

                if (renew) {
                    logger.warn(`Renewing visitor Cookies from ${url}`);
                } else {
                    logger.info(`Fetching visitor Cookies from ${url}`);
                }
                visitorCookiesPromise = (async () => {
                    let times = 0;
                    const { page, destroy } = await getPlaywrightPage(url, {
                        onBeforeLoad: async (page) => {
                            const expectResourceTypes = new Set(['document', 'script', 'xhr', 'fetch']);
                            await page.setExtraHTTPHeaders({ 'User-Agent': weiboUtils.apiHeaders['User-Agent'] });
                            await page.route('**/*', (route) => {

View on GitHub (pinned to bed535e087)

Solutions

  1. Wait config.cache.routeExpire seconds (the cooldown window) and retry — the guard clears automatically.
  2. Set WEIBO_COOKIES to bypass the visitor-cookie fetch path entirely.
  3. Stagger/space out polling of weibo routes so concurrent calls do not collide during cooldown.
Defensive patterns

Strategy: retry

Validate before calling

// Track the cooldown window before issuing concurrent weibo requests
const routeExpireMs = (Number(process.env.CACHE_ROUTE_EXPIRE ?? 300)) * 1000;
const lastFetch = sharedState.lastWeiboVisitorFetch ?? 0;
if (Date.now() - lastFetch < routeExpireMs) {
    // skip or queue instead of triggering the cooldown throw
}

Type guard

function isWeiboCooldownError(e: unknown): boolean {
    return e instanceof Error && /Cooling down before new visitor Cookies/i.test(e.message);
}

Try / catch

for (const delay of [0, 5_000, 15_000]) {
    try {
        return await weiboUtils.getCookies(false);
    } catch (e) {
        if (!isWeiboCooldownError(e) || delay === 15_000) throw e;
        await new Promise((r) => setTimeout(r, delay));
    }
}

Prevention

When it happens

Trigger: A second request arrives while coolingDown is true and renew is falsy or a boolean (renew?.message is undefined), hitting the throw at utils.ts:73. Triggered by bursty traffic or concurrent route calls before the routeExpire cooldown elapses.

Common situations: Many readers polling weibo routes simultaneously right after startup or right after a prior fetch failure; aggressive RSS refresh intervals stacked on top of each other.

Related errors


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