DIYgod/RSSHub · error · ConfigNotFoundError

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

Error message

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

What it means

ConfigNotFoundError thrown by the manga-followings route when the manga bookshelf API returns code -6, indicating the cookie's session has expired. The POST to manga.bilibili.com/twirp/bookshelf.v1.Bookshelf/ListFavorite rejects the expired SESSDATA.

Source

Thrown at lib/routes/bilibili/manga-followings.ts:58

    const name = await cache.getUsernameFromUID(uid);

    const cookie = config.bilibili.cookies[uid];
    if (cookie === undefined) {
        throw new ConfigNotFoundError('缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值');
    }
    const page_size = ctx.req.param('limits') || 10;
    const link = 'https://manga.bilibili.com/account-center';
    const response = await got({
        method: 'POST',
        url: 'https://manga.bilibili.com/twirp/bookshelf.v1.Bookshelf/ListFavorite?device=pc&platform=web',
        json: { page_num: 1, page_size, order: 2, wait_free: 0 },
        headers: {
            Referer: link,
            Cookie: cookie,
        },
    });
    if (response.data.code === -6) {
        throw new ConfigNotFoundError('对应 uid 的 Bilibili 用户的 Cookie 已过期');
    }
    const comics = response.data.data;

    return {
        title: `${name} 的追漫更新 - 哔哩哔哩漫画`,
        link,
        item: comics.map((item) => ({
            title: `${item.title} ${item.latest_ep_short_title}`,
            description: `<img src='${item.vcover}'>`,
            pubDate: new Date(item.last_ep_publish_time + ' +0800'),
            link: `https://manga.bilibili.com/detail/mc${item.comic_id}`,
        })),
    };
}

View on GitHub (pinned to bed535e087)

Solutions

  1. Refresh BILIBILI_COOKIE_<uid> from a fresh browser login.
  2. Restart RSSHub to load the new cookie.
  3. Verify SESSDATA is present in the cookie string.

Example fix

// before: expired manga cookie
BILIBILI_COOKIE_123456=SESSDATA=old;...

// after
BILIBILI_COOKIE_123456=SESSDATA=fresh; bili_jct=xxx; DedeUserID=123456;
Defensive patterns

Strategy: retry

Try / catch

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

Prevention

When it happens

Trigger: The ListFavorite API returns code -6 for the configured cookie. The manga sub-service shares the main Bilibili session, so SESSDATA expiry affects it identically.

Common situations: SESSDATA expired after prolonged use; account password changed; cookie copied without SESSDATA; Bilibili session rotation.

Related errors


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