DIYgod/RSSHub · error · ConfigNotFoundError
缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
Error message
缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
What it means
ConfigNotFoundError thrown by /bilibili/message/sessions/:uid (private-message session list). The handler requires the per-uid Cookie to call https://api.vc.bilibili.com/session_svr/v1/session_svr/get_sessions; without BILIBILI_COOKIE_{uid} the cookies[uid] lookup is undefined and the route refuses to proceed. The dedicated subclass lets the host return a configuration-specific error.
Source
Thrown at lib/routes/bilibili/message-sessions.ts:150
case 12: // Article card
return `[专栏] ${parsed.title || ''}`;
case 14: // Bangumi card
return `[番剧] ${parsed.title || ''}`;
default:
return parsed.content || parsed.title || content;
}
} catch {
return content;
}
}
async function handler(ctx) {
const uid = ctx.req.param('uid');
const name = await bilibiliCache.getUsernameFromUID(uid);
const cookie = config.bilibili.cookies[uid];
if (cookie === undefined) {
throw new ConfigNotFoundError('缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值');
}
const response = await ofetch<SessionResponse>('https://api.vc.bilibili.com/session_svr/v1/session_svr/get_sessions', {
query: {
session_type: 1,
group_fold: 1,
unfollow_fold: 0,
sort_rule: 2,
build: 0,
mobi_app: 'web',
},
headers: {
Referer: 'https://message.bilibili.com/',
Cookie: cookie,
},
});
if (response.code !== 0) {View on GitHub (pinned to bed535e087)
Solutions
- Set BILIBILI_COOKIE_{uid} (matching the URL uid) to the full bilibili.com logged-in Cookie and restart RSSHub.
- Verify the variable is loaded: inspect config.bilibili.cookies keys, or `env | grep BILIBILI_COOKIE_` inside the container.
- Ensure the uid in the URL is byte-for-byte the suffix used in the env var name.
Example fix
// before: /bilibili/message/sessions/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 requireSessionsCookie(uid: string) {
if (config.bilibili.cookies[uid] === undefined) {
throw new Error(`BILIBILI_COOKIE_${uid} is required for /bilibili/message/sessions/${uid}`);
}
}
requireSessionsCookie('2267573'); Type guard
function isConfigNotFoundError(e: unknown): e is Error {
return e instanceof Error && e.name === 'ConfigNotFoundError';
} Try / catch
try { await sessionsHandler(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 readers.
- Add a startup check enumerating required cookies for the routes you expose.
- Keep URL uid and env-var suffix byte-identical.
When it happens
Trigger: Requesting /bilibili/message/sessions/:uid when BILIBILI_COOKIE_{uid} (with that exact uid) is not present in the RSSHub environment.
Common situations: Env var not added on a new deploy; feed URL uid differs from the configured account; env var typo or not exported into the container; cookie configured for a different message route but not this uid.
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/449de0f152ef0c8d.
Report an issue: GitHub.