DIYgod/RSSHub · error · ConfigNotFoundError

Weibo Friends Timeline is not available due to the absense o

Error message

Weibo Friends Timeline is not available due to the absense of [Weibo Cookies]. Check <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config tutorial</a>

What it means

Thrown by the Weibo friends timeline route when `config.weibo.cookies` is not set in the RSSHub configuration. This route requires authenticated Weibo cookies to access the friends feed API (`https://m.weibo.cn/feed/friends`), which is a private timeline. This is a `ConfigNotFoundError`, which RSSHub maps to an HTTP configuration-error response.

Source

Thrown at lib/routes/weibo/friends.ts:52

            target: '/friends',
        },
    ],
    name: '最新关注时间线',
    maintainers: ['CaoMeiYouRen'],
    handler,
    url: 'weibo.com/',
    description: `::: warning
此方案必须使用用户\`Cookie\`进行抓取

因微博 cookies 的过期与更新方案未经验证,部署一次 Cookie 的有效时长未知

微博用户 Cookie 的配置可参照部署文档
:::`,
};

async function handler(ctx) {
    if (!config.weibo.cookies) {
        throw new ConfigNotFoundError('Weibo Friends Timeline is not available due to the absense of [Weibo Cookies]. Check <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config tutorial</a>');
    }

    let displayVideo = '1';
    let displayArticle = '0';
    let displayComments = '0';
    if (ctx.req.param('routeParams')) {
        if (ctx.req.param('routeParams') === '1' || ctx.req.param('routeParams') === '0') {
            displayVideo = ctx.req.param('routeParams');
        } else {
            const routeParams = querystring.parse(ctx.req.param('routeParams'));
            displayVideo = fallback(undefined, queryToBoolean(routeParams.displayVideo), true) ? '1' : '0';
            displayArticle = fallback(undefined, queryToBoolean(routeParams.displayArticle), false) ? '1' : '0';
            displayComments = fallback(undefined, queryToBoolean(routeParams.displayComments), false) ? '1' : '0';
        }
    }

    const uid = await cache.tryGet(
        'weibo:friends:login-user',

View on GitHub (pinned to bed535e087)

Solutions

  1. Set the `WEIBO_COOKIES` environment variable in the RSSHub configuration with a valid Weibo cookie string obtained from a logged-in browser session.
  2. Follow the configuration tutorial linked in the error message: https://docs.rsshub.app/deploy/config#route-specific-configurations.
  3. If you cannot provide cookies (e.g. using a public instance), use a different Weibo route that doesn't require authentication.
Defensive patterns

Strategy: validation

Validate before calling

// In RSSHub config (environment variables):
// WEIBO_COOKIES=SUB=_2A25...; SCF=...; SUHB=...; SSOLock=...
// Verify before deploying:
if (!process.env.WEIBO_COOKIES) {
    console.warn('WEIBO_COOKIES not set — /weibo/friends will fail');
}

Try / catch

try {
    const feed = await fetchRss('/weibo/friends');
} catch (e) {
    if (e.name === 'ConfigNotFoundError') {
        console.error('Weibo cookies not configured. Set WEIBO_COOKIES env var.');
    }
    throw e;
}

Prevention

When it happens

Trigger: A request to `/weibo/friends` on an RSSHub instance where the `WEIBO_COOKIES` environment variable is not configured. The check happens at the very top of the handler (line 51) before any API call.

Common situations: The RSSHub instance was deployed without setting `WEIBO_COOKIES`; the environment variable was removed or commented out; or the user is using a public RSSHub instance that doesn't support cookie-dependent routes.

Related errors


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