DIYgod/RSSHub · error · ConfigNotFoundError

缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://do

Error message

缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://docs.rsshub.app/zh/deploy/config#route-specific-configurations">bilibili 用户关注动态系列路由</a>

What it means

ConfigNotFoundError thrown by the bilibili followers route when config.bilibili.cookies[loginUid] is undefined. The followers API needs a logged-in user's cookie to list who follows a given uid, so a missing cookie for the supplied loginUid makes the route unusable and points the operator at the deploy docs.

Source

Thrown at lib/routes/bilibili/followers.ts:50

            source: ['space.bilibili.com/:uid'],
            target: '/user/followers/:uid',
        },
    ],
    name: 'UP 主粉丝',
    maintainers: ['Qixingchen'],
    handler,
    description: `::: warning
UP 主粉丝现在需要 b 站登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。
:::`,
};

async function handler(ctx) {
    const uid = ctx.req.param('uid');
    const loginUid = ctx.req.param('loginUid');

    const cookie = config.bilibili.cookies[loginUid];
    if (cookie === undefined) {
        throw new ConfigNotFoundError('缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://docs.rsshub.app/zh/deploy/config#route-specific-configurations">bilibili 用户关注动态系列路由</a>');
    }

    const name = await cache.getUsernameFromUID(uid);

    const countResponse = await got({
        method: 'get',
        url: `https://api.bilibili.com/x/relation/stat?vmid=${uid}`,
        headers: {
            Referer: `https://space.bilibili.com/${uid}/`,
        },
    });
    const count = countResponse.data.data.follower;

    const response = await got({
        method: 'get',
        url: `https://api.bilibili.com/x/relation/followers?vmid=${uid}`,
        headers: {
            Referer: `https://space.bilibili.com/${uid}/`,

View on GitHub (pinned to bed535e087)

Solutions

  1. Add a cookie entry for the loginUid account under config.bilibili.cookies (see https://docs.rsshub.app/deploy/config) — copy SESSDATA/BUSS from a logged-in bilibili.com session.
  2. Restart RSSHub and re-request with that loginUid.
Defensive patterns

Strategy: validation

Validate before calling

const cookie = config.bilibili.cookies[loginUid];
if (cookie === undefined) {
    throw new ConfigNotFoundError(`Missing bilibili cookie for loginUid ${loginUid}.`);
}

Type guard

function hasLoginCookie(loginUid: string): boolean {
    return config.bilibili.cookies[loginUid] !== undefined;
}

Prevention

When it happens

Trigger: Calling /bilibili/followers/:uid/:loginUid where loginUid has no entry in config.bilibili.cookies (e.g. cookies only configured for a different account).

Common situations: Self-hosted instance configured one bilibili cookie but the request names a different loginUid; cookie map key typo; env var not loaded.

Related errors


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