DIYgod/RSSHub · error · ConfigNotFoundError

缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值

Error message

缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值

What it means

ConfigNotFoundError thrown by the manga-followings route when config.bilibili.cookies[uid] is undefined. This route fetches the user's followed manga list from Bilibili Comics (manga.bilibili.com) via a POST to the bookshelf API, which requires authentication. Without the cookie, the request would return an empty/unauthorized response.

Source

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

        supportBT: false,
        supportPodcast: false,
        supportScihub: false,
    },
    name: '用户追漫更新',
    maintainers: ['yindaheng98'],
    handler,
    description: `::: warning
用户追漫需要 b 站登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。
:::`,
};

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

View on GitHub (pinned to bed535e087)

Solutions

  1. Set BILIBILI_COOKIE_<uid> with a cookie from an account that has manga follows.
  2. Ensure the cookie includes SESSDATA (the manga API checks the same session).
  3. Restart RSSHub after configuration.

Example fix

// before: no manga cookie configured

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

Strategy: validation

Validate before calling

const uid = String(ctx.req.param('uid'));
if (!config.bilibili.cookies?.[uid]) {
    throw new ConfigNotFoundError(`Set BILIBILI_COOKIE_${uid} for manga access`);
}

Type guard

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

Prevention

When it happens

Trigger: Requesting /bilibili/manga/followings/:uid when no BILIBILI_COOKIE_<uid> env var is set. The cookie is needed because the manga bookshelf is account-private data.

Common situations: Cookie not configured; uid mismatch between route param and env var; operator didn't realize manga routes also need the bilibili cookie.

Related errors


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