DIYgod/RSSHub · error · ConfigNotFoundError
缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
Error message
缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
What it means
ConfigNotFoundError thrown by /bilibili/message/unread/:uid (unread-count summary). The handler calls two endpoints (msgfeed/unread and session_svr/single_unread) in parallel via Promise.all, both requiring the per-uid Cookie; if config.bilibili.cookies[uid] is undefined the route aborts up front with the dedicated subclass.
Source
Thrown at lib/routes/bilibili/message-unread.ts:82
data: {
unfollow_unread: number;
follow_unread: number;
unfollow_push_msg: number;
dustbin_push_msg: number;
dustbin_unread: number;
biz_msg_unfollow_unread: number;
biz_msg_follow_unread: number;
custom_unread: number;
};
}
async function handler(ctx) {
const uid = 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 值');
}
// Fetch message unread counts
const [msgUnread, sessionUnread] = await Promise.all([
ofetch<UnreadMsgResponse>('https://api.vc.bilibili.com/x/im/web/msgfeed/unread', {
query: {
build: 0,
mobi_app: 'web',
},
headers: {
Referer: 'https://message.bilibili.com/',
Cookie: cookie,
},
}),
ofetch<UnreadSessionResponse>('https://api.vc.bilibili.com/session_svr/v1/session_svr/single_unread', {
query: {
unread_type: 0,
show_dustbin: 1,View on GitHub (pinned to bed535e087)
Solutions
- Set BILIBILI_COOKIE_{uid} (matching the URL uid) to the full logged-in bilibili.com Cookie; restart RSSHub.
- Verify the variable is loaded (config.bilibili.cookies keys or `env | grep BILIBILI_COOKIE_`).
- Ensure URL uid and env var suffix match exactly.
Example fix
// before: /bilibili/message/unread/2267573 with no env -> ConfigNotFoundError // after: // BILIBILI_COOKIE_2267573=SESSDATA=...; bili_jct=...; DedeUserID=2267573; ...
Defensive patterns
Strategy: validation
Validate before calling
import { config } from '@/config';
function requireUnreadCookie(uid: string) {
if (config.bilibili.cookies[uid] === undefined) {
throw new Error(`Set BILIBILI_COOKIE_${uid} for /bilibili/message/unread/${uid}`);
}
}
requireUnreadCookie('2267573'); Type guard
function isConfigNotFoundError(e: unknown): e is Error {
return e instanceof Error && e.name === 'ConfigNotFoundError';
} Try / catch
try { await unreadHandler(ctx); }
catch (e) {
if (e instanceof Error && e.name === 'ConfigNotFoundError') {
ctx.status = 503; ctx.body = { error: 'Missing BILIBILI_COOKIE_' + uid }; return;
}
throw e;
} Prevention
- Provision BILIBILI_COOKIE_{uid} for each uid before subscribing the unread feed.
- Add a startup self-check that asserts the cookie exists for each enabled route.
- Keep URL uid and env-var suffix byte-identical.
When it happens
Trigger: Requesting /bilibili/message/unread/:uid when BILIBILI_COOKIE_{uid} for that uid is not set in the RSSHub environment.
Common situations: Operator added a cookie for the like/reply feeds but not for the same uid here; URL uid differs from configured uid; env var not exported into the container.
Related errors
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://do
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/87e227b36321312b.
Report an issue: GitHub.