DIYgod/RSSHub · error · ConfigNotFoundError
缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
Error message
缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
What it means
ConfigNotFoundError thrown by RSSHub's bilibili followings-article route when no Cookie is configured for the requested uid. The handler reads config.bilibili.cookies[uid] and if it returns undefined, the route cannot authenticate to Bilibili's dynamic_svr API (which requires a logged-in session to fetch another user's article dynamics, type=64). This is a deployment-configuration error, not a runtime/network error.
Source
Thrown at lib/routes/bilibili/followings-article.ts:44
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: '用户关注专栏',
maintainers: ['woshiluo'],
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 response = await got({
method: 'get',
url: `https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=${uid}&type=64`,
headers: {
Referer: `https://space.bilibili.com/${uid}/`,
Cookie: cookie,
},
});
if (response.data.code === -6) {
throw new ConfigNotFoundError('对应 uid 的 Bilibili 用户的 Cookie 已过期');
}
const cards = response.data.data.cards;
const out = await Promise.all(
cards.map(async (card) => {
const card_data = JSON.parse(card.card);View on GitHub (pinned to bed535e087)
Solutions
- Set the environment variable BILIBILI_COOKIE_<uid> (e.g. BILIBILI_COOKIE_123456=...) with a valid logged-in Bilibili cookie string for that account, then restart RSSHub.
- Verify the uid in the route URL exactly matches the numeric suffix in the env var name.
- Extract the cookie from a logged-in browser session on space.bilibili.com (DevTools > Network > copy Cookie header) and use the full string.
- Confirm config.bilibili.cookies is being populated by checking lib/config.ts and your .env file is loaded.
Example fix
// before: no env var set // Route: /bilibili/followings/article/123456 // after: in .env or docker env BILIBILI_COOKIE_123456=SESSDATA=xxx; bili_jct=xxx; DedeUserID=123456;
Defensive patterns
Strategy: validation
Validate before calling
// Before calling the route, verify the cookie exists
const uid = String(ctx.req.param('uid'));
const cookie = config.bilibili.cookies[uid];
if (cookie === undefined) {
// Return a friendly error or redirect to config docs
throw new ConfigNotFoundError(
`No cookie configured for uid ${uid}. Set BILIBILI_COOKIE_${uid} in your environment.`
);
} Type guard
function hasBilibiliCookie(uid: string): boolean {
return typeof config.bilibili.cookies?.[uid] === 'string'
&& config.bilibili.cookies[uid].includes('SESSDATA');
} Prevention
- Document every BILIBILI_COOKIE_<uid> env var in your deployment checklist.
- Use a startup health check that validates config.bilibili.cookies is non-empty.
- Name cookie env vars with the exact uid to avoid mismatches.
When it happens
Trigger: Calling the /bilibili/followings/article/:uid route when the RSSHub instance's BILIBILI_COOKIE_* environment variable for that uid has not been set. The lookup config.bilibili.cookies[uid] resolves to undefined because no cookie key matching the route's :uid parameter exists in the cookies map.
Common situations: Self-hosted RSSHub where the operator forgot to add the BILIBILI_COOKIE_<uid> env var; using a uid that doesn't match any configured cookie key; cookies map keys are numeric strings and the route param is also stringified but the two don't align; fresh deploy without reading the deployment config docs.
Related errors
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://do
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/1f6cb82a82fc5e08.
Report an issue: GitHub.