DIYgod/RSSHub · error · ConfigNotFoundError
对应 uid 的 Bilibili 用户的 Cookie 已过期
Error message
对应 uid 的 Bilibili 用户的 Cookie 已过期
What it means
ConfigNotFoundError thrown when Bilibili's dynamic_svr API returns code -6, indicating the configured Cookie for the uid has expired or the session is no longer valid. The followings-article route checks response.data.code after the authenticated request and maps -6 to this expired-cookie error. Bilibili sessions (SESSDATA) expire periodically, so a previously working deployment will start failing.
Source
Thrown at lib/routes/bilibili/followings-article.ts:56
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);
const { url: link, description } = await cache.getArticleDataFromCvid(card_data.id, uid);
const item = {
title: card_data.title,
description,
pubDate: new Date(card_data.publish_time * 1000).toUTCString(),
link,
author: card.desc.user_profile.info.uname,
};
return item;
})
);View on GitHub (pinned to bed535e087)
Solutions
- Log into bilibili.com in a browser, re-copy the full Cookie (especially SESSDATA and DedeUserID), and update BILIBILI_COOKIE_<uid>.
- Restart RSSHub after updating the env var so the new cookie is loaded.
- If the error persists immediately after updating, verify SESSDATA is present in the cookie string and the account is not locked.
Example fix
// before: expired cookie BILIBILI_COOKIE_123456=SESSDATA=old_expired_value;... // after: fresh cookie from browser BILIBILI_COOKIE_123456=SESSDATA=new_valid_value; bili_jct=xxx; DedeUserID=123456;
Defensive patterns
Strategy: retry
Try / catch
try {
const response = await got({...});
if (response.data.code === -6) {
// Optionally: alert the operator to refresh the cookie
logger.warn(`Cookie expired for uid=${uid}. Update BILIBILI_COOKIE_${uid}.`);
throw new ConfigNotFoundError('Cookie expired');
}
} catch (e) {
if (e instanceof ConfigNotFoundError) {
// Surface as a config error, not a crash
}
throw e;
} Prevention
- Set up monitoring/alerting that detects repeated -6 codes and notifies you to refresh cookies.
- Schedule periodic cookie refreshes before SESSDATA expiry (typically every few weeks).
- Keep a documented procedure for extracting fresh cookies from the browser.
When it happens
Trigger: The dynamic_new API (type=64) responds with {"code":-6,...} meaning 'account not logged in / credentials invalid'. This happens after SESSDATA expires, the user logged out of the account on the web, or Bilibili invalidated the session for security reasons.
Common situations: Cookie was set weeks/months ago and SESSDATA naturally expired; the account owner changed their password causing all sessions to invalidate; Bilibili rotated the session token; the cookie string was copied incompletely (missing SESSDATA).
Related errors
- 对应 uid 的 Bilibili 用户的 Cookie 已过期
- 对应 loginUid 的 Bilibili 用户的 Cookie 已过期
- 对应 uid 的 Bilibili 用户的 Cookie 已过期
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/19a8497383782593.
Report an issue: GitHub.