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 followings ('UP 主关注用户') route when config.bilibili.cookies[loginUid] is undefined. Note this route uses loginUid (the account whose cookie is used) separately from uid (the user whose followings are queried). The error message includes a documentation link. This requires the operator to set up a cookie for the *viewing* account (loginUid), not the target uid.

Source

Thrown at lib/routes/bilibili/followings.ts:49

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

async function handler(ctx) {
    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 uid = ctx.req.param('uid');
    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.following;

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

View on GitHub (pinned to bed535e087)

Solutions

  1. Set BILIBILI_COOKIE_<loginUid> where loginUid is YOUR account uid (the viewer), not the target.
  2. Ensure the route URL uses the correct loginUid as the first path parameter.
  3. Follow the docs link in the error message for the deployment config module.
  4. Restart RSSHub after setting the env var.

Example fix

// before: cookie set for wrong uid
BILIBILI_COOKIE_999999=...  // but route is /bilibili/followings/111111/999999

// after: cookie for the loginUid (viewer account)
BILIBILI_COOKIE_111111=SESSDATA=xxx; bili_jct=xxx; DedeUserID=111111;
Defensive patterns

Strategy: validation

Validate before calling

const loginUid = ctx.req.param('loginUid');
if (!config.bilibili.cookies?.[loginUid]) {
    throw new ConfigNotFoundError(
        `Set BILIBILI_COOKIE_${loginUid} — this is the VIEWING account, not the target.`
    );
}

Type guard

function hasLoginCookie(loginUid: string): boolean {
    return typeof config.bilibili.cookies?.[loginUid] === 'string';
}

Prevention

When it happens

Trigger: Requesting /bilibili/followings/:loginUid/:uid when BILIBILI_COOKIE_<loginUid> is not configured. The route needs the loginUid account to be authenticated because Bilibili only exposes followings lists to logged-in users.

Common situations: Operator set a cookie for the target uid but not for loginUid; confusion between the two parameters (loginUid = your account, uid = whose followings you want); the documentation link in the message was not followed.

Related errors


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