DIYgod/RSSHub · error · ConfigNotFoundError

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

Error message

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

What it means

ConfigNotFoundError thrown by the bilibili followers route when the followers API returns code -6 (not logged in) or -101 (credentials invalid). Since a cookie was present (else error 78 would have fired), these codes mean the cookie for loginUid has expired or been revoked.

Source

Thrown at lib/routes/bilibili/followers.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.follower;

    const response = await got({
        method: 'get',
        url: `https://api.bilibili.com/x/relation/followers?vmid=${uid}`,
        headers: {
            Referer: `https://space.bilibili.com/${uid}/`,
            Cookie: cookie,
        },
    });
    if (response.data.code === -6 || response.data.code === -101) {
        throw new ConfigNotFoundError('对应 loginUid 的 Bilibili 用户的 Cookie 已过期');
    }
    const data = response.data.data.list;

    return {
        title: `${name} 的 bilibili 粉丝`,
        link: `https://space.bilibili.com/${uid}/#/fans/fans`,
        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-log into bilibili.com, copy a fresh SESSDATA (and bili_jct) for the loginUid account, update config.bilibili.cookies[loginUid], and restart RSSHub.
  2. If it reoccurs quickly, check whether the account is being challenged (verify the cookie still works in a browser).
Defensive patterns

Strategy: try-catch

Validate before calling

if (response.data.code === -6 || response.data.code === -101) {
    throw new ConfigNotFoundError('Cookie for loginUid has expired; please refresh.');
}

Type guard

function isExpiredCookieCode(code: number): boolean {
    return code === -6 || code === -101;
}

Try / catch

try {
    if (response.data.code === -6 || response.data.code === -101) {
        throw new ConfigNotFoundError('Cookie expired');
    }
} catch (e) {
    if (e instanceof ConfigNotFoundError) {
        // operator must refresh config.bilibili.cookies[loginUid]
    }
    throw e;
}

Prevention

When it happens

Trigger: config.bilibili.cookies[loginUid] is set, the followers request is sent with it, and bilibili responds with code -6 or -101.

Common situations: Cookie expired (bilibili sessions age out); user logged out / revoked sessions; SESSDATA was truncated when copied.

Related errors


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