DIYgod/RSSHub · error · ConfigNotFoundError

对应 loginUid 的 Bilibili 用户的 Cookie 已过期

Error message

对应 loginUid 的 Bilibili 用户的 Cookie 已过期

What it means

ConfigNotFoundError thrown by the followings route when Bilibili's /x/relation/followings API returns code -6, indicating the loginUid's cookie (SESSDATA) has expired. The authenticated request to fetch a user's following list is rejected because the session is invalid.

Source

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

    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: {
            Referer: `https://space.bilibili.com/${uid}/`,
            Cookie: cookie,
        },
    });
    if (response.data.code === -6) {
        throw new ConfigNotFoundError('对应 loginUid 的 Bilibili 用户的 Cookie 已过期');
    }
    // 22115 : 用户已设置隐私,无法查看
    if (response.data.code === 22115) {
        throw new InvalidParameterError(response.data.message);
    }
    const data = response.data.data.list;

    return {
        title: `${name} 的 bilibili 关注`,
        link: `https://space.bilibili.com/${uid}/#/fans/follow`,
        description: `${name} 的 bilibili 关注`,
        item: data.map((item) => ({
            title: `${name} 新关注 ${item.uname}`,
            description: `${item.uname}<br>${item.sign}<br>总计${count}`,
            pubDate: new Date(item.mtime * 1000),
            link: `https://space.bilibili.com/${item.mid}`,
        })),
    };

View on GitHub (pinned to bed535e087)

Solutions

  1. Re-login to bilibili.com with the loginUid account and copy a fresh Cookie.
  2. Update BILIBILI_COOKIE_<loginUid> and restart RSSHub.
  3. Verify SESSDATA is included in the cookie value.

Example fix

// before: expired loginUid cookie
BILIBILI_COOKIE_111111=SESSDATA=old;...

// after
BILIBILI_COOKIE_111111=SESSDATA=fresh; bili_jct=xxx; DedeUserID=111111;
Defensive patterns

Strategy: retry

Try / catch

try {
    const response = await got({...});
    if (response.data.code === -6) {
        throw new ConfigNotFoundError('loginUid cookie expired');
    }
} catch (e) {
    throw e;
}

Prevention

When it happens

Trigger: The relation/followings endpoint returns code -6 for the loginUid cookie. Occurs after SESSDATA expiry, account password change, or Bilibili session invalidation.

Common situations: Cookie set long ago and expired naturally; password changed on the loginUid account; cookie string truncated; Bilibili security rotation.

Related errors


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